How to use a value instead of a string in regular expression?

Discussion in 'Perl Misc' started by mrz2003, Aug 17, 2005.

  1. mrz2003

    mrz2003 Guest

    For example, if $aaa=="1.1", then by using
    "$aaa =~ s/(\d+)$/($1)+1/;"
    I want to change $aaa to "1.2".
    Of couse, the regular expression is not correct.
    Thanks!
     
    mrz2003, Aug 17, 2005
    #1
    1. Advertising

  2. mrz2003 wrote:
    > For example, if $aaa=="1.1", then by using
    > "$aaa =~ s/(\d+)$/($1)+1/;"
    > I want to change $aaa to "1.2".


    Add the /e modifier.

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
     
    Gunnar Hjalmarsson, Aug 17, 2005
    #2
    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,307
  2. =?Utf-8?B?dGQxMzY5?=

    get value from html string over regular expression

    =?Utf-8?B?dGQxMzY5?=, Nov 20, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    569
    Kevin Spencer
    Nov 20, 2005
  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. Replies:
    7
    Views:
    788
    Pasi Savolainen
    Feb 26, 2006
  5. andyo
    Replies:
    1
    Views:
    775
    Vincent Fourmond
    Feb 27, 2007
Loading...

Share This Page