/* Returns enum type. search returns the pointer to use for comparison. not returns 1 if buff started with a '!' 0 otherwise.  */
enum regex_type filter_parse_regex(char *buff, int len, char **search, int *not)
/* Returns enum type. search returns the pointer to use for comparison. not returns 1 if buff started with a '!' 0 otherwise.  */
enum regex_type filter_parse_regex(char *buff, int len, char **search, int *not)
{
	int type = MATCH_FULL;
	int i;
	if (buff[0] == '!') {
		*not = 1;
		buff++;
		len--;
	} else
		*not = 0;
	*search = buff;
	for (i = 0; i < len; i++) {
		if (buff[i] == '*') {
			if (!i) {
				*search = buff + 1;
				type = MATCH_END_ONLY;
			} else {
				if (type == MATCH_END_ONLY)
					type = MATCH_MIDDLE_ONLY;
				else
					type = MATCH_FRONT_ONLY;
				buff[i] = 0;
				break;
			}
		}
	}
	return type;
}