regular expression syntax the same in Python, Perl and grep?

S

seberino

How similar is Python's re module (regular expressions) compared
to Perl's and grep's regular expression syntaxes?

I really hope regular expression syntax is sufficiently standardized
that
we don't have to learn new dialects everytime we move from one
language or shell command to another.

chris
 
C

Chris Mellon

How similar is Python's re module (regular expressions) compared
to Perl's and grep's regular expression syntaxes?

Somewhat.

I really hope regular expression syntax is sufficiently standardized
that
we don't have to learn new dialects everytime we move from one
language or shell command to another.

It isn't, at least for non-trivial use of regexps.
 
M

Martin Marcher

I forgot where I read that so can't back it up but:

"Unices are just a collection of different dialects of regex"

I think the same is true for about every implementation of regex you
can find. In theory it _should_ be same.

Then again, so should SQL but I bet that it's actually quite hard to
find a single statement that you can literally execute it on all DB
servers (major ones).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,008
Latest member
HaroldDark

Latest Threads

Top