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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • seberino@spawar.navy.mil

    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

  • Chris Mellon

    #2
    Re: regular expression syntax the same in Python, Perl and grep?

    On Nov 7, 2007 12:11 PM, seberino@spawar .navy.mil
    <seberino@spawa r.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.

    Comment

    • Martin Marcher

      #3
      Re: regular expression syntax the same in Python, Perl and grep?

      2007/11/7, Chris Mellon <arkanes@gmail. com>:
      On Nov 7, 2007 12:11 PM, seberino@spawar .navy.mil
      <seberino@spawa r.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).


      --


      Comment

      • BartlebyScrivener

        #4
        Re: regular expression syntax the same in Python, Perl and grep?

        On Nov 7, 12:11 pm, "seber...@spawa r.navy.mil"
        <seber...@spawa r.navy.milwrote :
        How similar is Python's re module (regular expressions) compared
        to Perl's and grep's regular expression syntaxes?


        rd


        Comment

        Working...