Regexp: modify $1 within the replace clause?
From: Yaroslav (carpathian81_at_yahoo.com)
Date: 04/16/04
- Previous message: yzhshi: "Re: why i get different result from command line and browser?(not 500 Err)"
- Next in thread: Joe Smith: "Re: Regexp: modify $1 within the replace clause?"
- Reply: Joe Smith: "Re: Regexp: modify $1 within the replace clause?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 16 Apr 2004 07:41:26 -0700
Hi all,
Consider the following trivial example:
$_ =~ s/<matching_expression>/<clause_that_uses_$1>/g;
Is there a way to build such a regular expression, that matches some
string and modifies the match (e.g. $1) before using it in the replace
clause? What if I want to do something with $1 before I use it to
replace something? Is there a way to insert, say, a function of $1
there, rather than $1 itself?
TIA.
~yaroslav
- Previous message: yzhshi: "Re: why i get different result from command line and browser?(not 500 Err)"
- Next in thread: Joe Smith: "Re: Regexp: modify $1 within the replace clause?"
- Reply: Joe Smith: "Re: Regexp: modify $1 within the replace clause?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|