Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the matching result of boost regex match algorithm is different from "grep -P" and pcre2 #156

Closed
zhangyiru opened this issue Sep 28, 2021 · 1 comment

Comments

@zhangyiru
Copy link
Contributor

three regex match algorithm results is following:
the first pattern string is "(a((?0)( ))?+)?+(SKIP) ?(?1)?".
By replacing "?1" with "(a((?0)( ))?+)", we get the second pattern string that is "(a((?0)( ))?+)?+(SKIP) ?((a((?0)( ))?+))?"
the text string both is " aa " ,space before and after "aa".

1.boost
(a((?0)( ))?+)?+(SKIP) ?(?1)?
aa
result: assert failed (https://github.com/boostorg/regex/issues/152)

(a((?0)( ))?+)?+(SKIP) ?((a((?0)( ))?+))?
result: not matched

2.pcre2
(a((?0)( ))?+)?+(SKIP) ?(?1)?
aa
result: matched

(a((?0)( ))?+)?+(SKIP) ?((a((?0)( ))?+))?
result: matched

3.grep -P
/root/a.txt include " aa "
grep -P "(a((?0)( ))?+)?+(SKIP) ?(?1)?" /root/a.txt
result: matched

grep -P "(a((?0)( ))?+)?+(SKIP) ?((a((?0)( ))?+))?" /root/a.txt
result: matched

According to three results,pcre2 and "grep -P" can match, so is there a problem with boost regex match algorithm? who knows that , i do not know much about the boost regex.
thanks~

@zhangyiru
Copy link
Contributor Author

fixed by #165
closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant