472,108 Members | 1,376 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,108 software developers and data experts.

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

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

Nov 7 '07 #1
3 2687
On Nov 7, 2007 12:11 PM, se******@spawar.navy.mil
<se******@spawar.navy.milwrote:
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.
Nov 7 '07 #2
2007/11/7, Chris Mellon <ar*****@gmail.com>:
On Nov 7, 2007 12:11 PM, se******@spawar.navy.mil
<se******@spawar.navy.milwrote:
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.
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).
--
http://noneisyours.marcher.name
http://feeds.feedburner.com/NoneIsYours
Nov 7 '07 #3
On Nov 7, 12:11 pm, "seber...@spawar.navy.mil"
<seber...@spawar.navy.milwrote:
How similar is Python's re module (regular expressions) compared
to Perl's and grep's regular expression syntaxes?
http://en.wikipedia.org/wiki/Compari...ession_engines

rd
Nov 8 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

23 posts views Thread by Paul Rubin | last post: by
19 posts views Thread by Davy | last post: by
1 post views Thread by Wehrdamned | last post: by
47 posts views Thread by Henning_Thornblad | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.