regular expression for perl, tcl, sed, grep, awk

Discussion in 'Perl Misc' started by Jay eL, Dec 9, 2003.

  1. Jay eL

    Jay eL Guest

    Hi all,

    I wonder is the regular expression the same for perl, tcl, sed, grep
    and awk except for the syntax? all the usage for . * ? + / () [] are
    the same?

    Thanks in advance
     
    Jay eL, Dec 9, 2003
    #1
    1. Advertising

  2. On 8 Dec 2003 17:59:53 -0800,
    Jay eL <> wrote:
    > Hi all,
    >
    > I wonder is the regular expression the same for perl, tcl, sed, grep
    > and awk except for the syntax?


    It's a bit of an odd question. What do you mean "the same" "except for
    the syntax"? The syntax is different in many cases, and the features
    are also different for many of them. It also depends on your platform
    which sorts of RE are supported by your sed, grep and awk. There are
    minimal sets defined by standards, but that doesn't mean that your
    local ones don't support more.

    Generally: unless the software specifically mentions that it supports
    Perl's RE, it won't. Perl's RE engine is pretty much the most powerful
    out there (pcre is a library making Perl RE available to other
    programs).

    Some tools support more than one RE syntax, depending on invocation
    and arguments.

    I don't know which RE tcl supports nowadays. I haven't touched it in
    about 8 years.

    > all the usage for . * ? + / () [] are
    > the same?


    The slash is not a special character in regular expressions, but it's
    most often used as the delimiter for the operators that take regular
    expressions in tools that do.

    The others should all pretty much act the same, although in some RE
    engines you actually need to escape some of them to make them special.

    You'll have to read the documentation of the tool or language you're
    interested in to find out more.


    Why did you ask this question in a Perl group? Or did you post it
    independently to a bunch of other groups as well?

    Martien
    --
    |
    Martien Verbruggen | You can't have everything, where would you
    Trading Post Australia | put it?
    |
     
    Martien Verbruggen, Dec 9, 2003
    #2
    1. Advertising

  3. On 8 Dec 2003 17:59:53 -0800
    (Jay eL) wrote:

    > Hi all,
    >
    > I wonder is the regular expression the same for perl, tcl, sed, grep
    > and awk except for the syntax? all the usage for . * ? + / () []
    > are the same?


    perldoc perlre

    This will give information on regular expressions usage in Perl. I'm
    thinking other languages have documentation as well.

    O'Reilly has a book .... "Mastering Regular Expressions". Maybe this
    would aid in whatever comparison you're making. I don't know off hand
    if there are any resources on the 'Net for this - but if you use
    Google, you might get some hits.

    HTH

    --
    Jim

    Copyright notice: all code written by the author in this post is
    released under the GPL. http://www.gnu.org/licenses/gpl.txt
    for more information.

    a fortune quote ...
    Hark, Hark, the dogs do bark The Duke is fond of kittens He likes
    to take their insides out And use them for his mittens From "The
    Thirteen Clocks"
     
    James Willmore, Dec 9, 2003
    #3
    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. NNTP

    sed awk or perl for this?

    NNTP, Sep 11, 2003, in forum: Perl
    Replies:
    13
    Views:
    3,478
    Alan Connor
    Sep 30, 2003
  2. gorda
    Replies:
    2
    Views:
    544
    Andrew Shitov
    Oct 21, 2003
  3. NNTP
    Replies:
    2
    Views:
    949
    rakesh sharma
    Apr 7, 2004
  4. hofer
    Replies:
    11
    Views:
    2,636
  5. bolega
    Replies:
    6
    Views:
    2,049
Loading...

Share This Page