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

Discussion in 'Python' started by seberino@spawar.navy.mil, Nov 7, 2007.

  1. Guest

    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, 2007
    #1
    1. Advertising

  2. Chris Mellon Guest

    On Nov 7, 2007 12:11 PM,
    <> wrote:
    > 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.
     
    Chris Mellon, Nov 7, 2007
    #2
    1. Advertising

  3. 2007/11/7, Chris Mellon <>:
    > On Nov 7, 2007 12:11 PM,
    > <> wrote:
    > > 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
     
    Martin Marcher, Nov 7, 2007
    #3
  4. BartlebyScrivener, Nov 8, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. VSK
    Replies:
    2
    Views:
    2,355
  2. Sreedhar Vankayala
    Replies:
    2
    Views:
    714
    Sreedhar Vankayala
    Dec 4, 2004
  3. pekka niiranen
    Replies:
    5
    Views:
    551
    Paul McGuire
    Oct 20, 2004
  4. Jay eL
    Replies:
    2
    Views:
    214
    James Willmore
    Dec 9, 2003
  5. Kimi

    grep using regular expression

    Kimi, Dec 5, 2006, in forum: Perl Misc
    Replies:
    3
    Views:
    141
Loading...

Share This Page