i have requirement to store the regex in flat file and read them.There will be 1000 regex (i mean 1000 lines with 3 regex pattern each on one line seperated by a delimeter say #).
And the first regex1 is of type hex and other 2 are integers.
FLAT FILE will have
regex1#regex2#regex3
i have now 2 requirement
1)I want throw an error if the regex are not valid.
This im doing via regcomp function and this basically will check whether it is a proper regex or not(like missing brackets and all).
2)I have one more requirement wherein i need to valid all possible values for the regex which can be derived and throw an error if the operator enters the wrong entry in file.
How can achieve my second goal is my second question
Meaning
say regex1 can be represented in hex but it can be represented in many ways,i knw the length of the regex1,regex2 and regex3.But i want to know whether they are valid regex or not.
basically in short i want to knw is there anything in C regex library which will validate my regex pattern.
I’ve had great luck with
pcre. It’s lightweight, simple C code which handles regex parsing very well and it’s also extremely fast.