LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   PCRE in Python (https://www.linuxquestions.org/questions/programming-9/pcre-in-python-4175607959/)

Turbocapitalist 06-15-2017 06:02 AM

PCRE in Python
 
How complete a subset of Perl's pattern matching is in Python's PCRE? Which version of Perl is it equivalent to?

audriusk 06-15-2017 11:54 AM

I have virtually no experience with Perl, so all I can do is refer you to documentation of re module from Python standard library.

pan64 06-15-2017 12:15 PM

Oh, yes, there is no perfect answer. All of the PCRE implementations are different, but you can say they are mainly offering only a subset of the real perl implementation. But obviously/unfortunately it also depends on the version of PCRE/perl itself. I wouldn't say about equivalence.
If you need a special kind of RE you need to check if that works. If you have a special case please show us. I think in most cases the rework of those REs may help.

dugan 06-16-2017 02:06 PM

No idea. But in addition to the documentation that adriusk referred you to:

Quote:

Originally Posted by audriusk (Post 5723079)
I have virtually no experience with Perl, so all I can do is refer you to documentation of re module from Python standard library.

you can also look at the unit tests:

https://github.com/python/cpython/bl...st/re_tests.py

Turbocapitalist 06-17-2017 10:24 AM

Quote:

Originally Posted by dugan (Post 5723519)
you can also look at the unit tests:

https://github.com/python/cpython/bl...st/re_tests.py

Thanks. That is very useful. I can compare that against this one, if I understand the two test files correctly:

https://github.com/Perl/perl5/blob/blead/t/re/re_tests

It looks like manual comparison is necessary.

pan64, I don't have a specific use-case handy. It is more a wish to know the relative status.


All times are GMT -5. The time now is 03:43 AM.