LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-15-2017, 06:02 AM   #1
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,307
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
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?
 
Old 06-15-2017, 11:54 AM   #2
audriusk
Member
 
Registered: Mar 2011
Location: Klaipėda, Lithuania
Distribution: Slackware
Posts: 360

Rep: Reputation: 199Reputation: 199
I have virtually no experience with Perl, so all I can do is refer you to documentation of re module from Python standard library.
 
1 members found this post helpful.
Old 06-15-2017, 12:15 PM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,839

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
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.
 
Old 06-16-2017, 02:06 PM   #4
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,223

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

Quote:
Originally Posted by audriusk View Post
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

Last edited by dugan; 06-16-2017 at 02:15 PM.
 
1 members found this post helpful.
Old 06-17-2017, 10:24 AM   #5
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,307

Original Poster
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
Quote:
Originally Posted by dugan View Post
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] can't run make for PCRE User247 Linux - Server 8 11-07-2014 04:47 PM
[SOLVED] PCRE Validation Linux_Kidd Programming 8 06-28-2012 08:34 PM
[SOLVED] PCRE Question MTK358 Programming 11 06-01-2011 11:12 AM
How to use PCRE in C ? raiux Programming 1 11-23-2007 06:43 AM
PCRE Regex Osiris990 Programming 10 10-22-2007 02:43 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration