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

inconstitance between re and re2 on match strings with newlines #40

Open
eligro91 opened this issue May 10, 2016 · 0 comments
Open

inconstitance between re and re2 on match strings with newlines #40

eligro91 opened this issue May 10, 2016 · 0 comments

Comments

@eligro91
Copy link

eligro91 commented May 10, 2016

see:

git clone https://github.com/axiak/pyre2.git
Cloning into 'pyre2'...
...
....
(env)Eliyahus-MacBook-Pro:~ eliyahugromman$ cd pyre2/
(env)Eliyahus-MacBook-Pro:pyre2 eliyahugromman$ python setup.py install
....
....
(env)Eliyahus-MacBook-Pro:pyre2 eliyahugromman$ pip freeze | grep re2
re2==0.2.23
(env)Eliyahus-MacBook-Pro:pyre2 eliyahugromman$ python
Python 2.7.10 (default, Oct 23 2015, 18:05:06)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> import re2
>>> pat = u'^.*?[-]+$'
>>> txt = u'''------------------------------------------------------
... '''
>>> re.match(pat, txt)
<_sre.SRE_Match object at 0x101c0e578>
>>> re2.match(pat, txt)
>>>

According to the docs for re $ matches "the end of the string or just before the newline at the end of the string". It seems re2 doesn't do this

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