I have a question regarding boost::regex pattern recognitions and groups
I created the following code, in it i created a pattern and a string to match:
1 2 3 4 5 6
p = "((a b (f+\\.))d d(\\3))";
str="a b ffff.d dfff.";
boost::regex pattern(p, boost::regex::icase&boost::regex::extended &~boost::regex::no_bk_refs);
bool match = boost::regex_match(str, pattern);
cout << str << ((match)?"-Pattern is legal":"-Pattern is illegal" )<< endl;
Pattern is illegal
I'm saw that my result is 'Pattern is illegal' because the group \\3 that reffers to (f+\\.) isn't equal to it. if I cange the input to
str="a b ffff.d dffff.";
The pattern is legal.
In other words my original plan was to use the \\3 instead of writting the pattern;
p = "((a b (f+\\.))d d(f+\\.))";
But I can see that in the ogiginal pattern it simply expect the same output to reappear
Is there a way I can use the group naming not to copy the (f+\\.) group?
Thanks, I hope my Q is clear since I'm new to the regex topic.