perl regular expression help

Discussion in 'Perl Misc' started by uttamhoode@gmail.com, Aug 7, 2006.

  1. Guest

    hi all,
    i have around 100 perl CGI scripts in which i want to delete some
    string.

    String is $abc::message{M001} i want to remove $abc::message{ } so
    that the string becomes M001.

    if i get regular expression for the above i will change the files using
    PERL command line

    Regards,
    uttam hoode
     
    , Aug 7, 2006
    #1
    1. Advertising

  2. -berlin.de Guest

    <> wrote in comp.lang.perl.misc:
    > hi all,
    > i have around 100 perl CGI scripts in which i want to delete some
    > string.
    >
    > String is $abc::message{M001} i want to remove $abc::message{ } so
    > that the string becomes M001.
    >
    > if i get regular expression for the above i will change the files using
    > PERL command line


    So what have you tried and how does it fail to do what you want?

    Anno
     
    -berlin.de, Aug 7, 2006
    #2
    1. Advertising

  3. Guest

    got the solution

    perl -pi -w -e 's/\$abc::message{(\D\d\d\d)}/$1/g;' *.cgi

    this will replace all $abc::message{xxx} to xx

    before it didnt work because i gave escape sequence to some special
    charatcers

    .....like this

    perl -pi -w -e 's/\$abc\:\:message\{(\D\d\d\d)\}/$1/g;' *.cgi

    Regards,
    uttam hoode


    -berlin.de wrote:

    > <> wrote in comp.lang.perl.misc:
    > > hi all,
    > > i have around 100 perl CGI scripts in which i want to delete some
    > > string.
    > >
    > > String is $abc::message{M001} i want to remove $abc::message{ } so
    > > that the string becomes M001.
    > >
    > > if i get regular expression for the above i will change the files using
    > > PERL command line

    >
    > So what have you tried and how does it fail to do what you want?
    >
    > Anno
     
    , Aug 7, 2006
    #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. Eric B.
    Replies:
    1
    Views:
    433
    Jim Gibson
    Dec 17, 2004
  2. VSK
    Replies:
    2
    Views:
    2,307
  3. =?iso-8859-1?B?bW9vcJk=?=

    Matching abitrary expression in a regular expression

    =?iso-8859-1?B?bW9vcJk=?=, Dec 1, 2005, in forum: Java
    Replies:
    8
    Views:
    851
    Alan Moore
    Dec 2, 2005
  4. pekka niiranen
    Replies:
    5
    Views:
    526
    Paul McGuire
    Oct 20, 2004
  5. Replies:
    10
    Views:
    143
    Tad McClellan
    Nov 12, 2007
Loading...

Share This Page