I\'ve been struggling with regular expressions in C (just /usr/include/regex.h).
I have (let\'s say) hundreds of regexps and one of them can match
You could have them give you a array of strings that contain your regexps and test each one of them.
//count is the number of regexps provided
int give_me_number_of_regex_group(const char *needle,const char** regexps, int count ){
for(int i = 0; i < count; ++i){
if(regex_match(needle, regexp[i])){
return i;
}
}
return -1; //didn't match any
}
or am i overseeing something?