Question

I was trying to use both pcre and re2 and I came up with the following observation.

When I give the string as

"ab cd"

and the pattern as

"^[^c]"

re2 returns NO MATCH but its actually a match.

That is to say when I type this RE2::FullMatch("ab cd", RE2("^[^c]")) I get FAIL/No Match.

Please let me know if I am going wrong somewhere or what is the problem?

Was it helpful?

Solution

RE2::FullMatch matches the entire string, like Jerry says.

There are two basic operators: RE2::FullMatch requires the regexp to match the entire input text, and RE2::PartialMatch looks for a match for a substring of the input text, returning the leftmost-longest match in POSIX mode and the same match that Perl would have chosen in Perl mode.

https://code.google.com/p/re2/wiki/CplusplusAPI

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top