in reply to Re: Substituting in the substitution!
in thread Substituting in the substitution!
The "/" can be in any part of the string, so a new regexp won't fix it. What I want is to capture four clusters and then, when substituting, replace the "/" inside the clusters.
Right now, I did this:$do_the_change_mon = sub { $thingy = shift; $thingy =~ tr|/|_|; return $thingy; } $expr = s| \[([A-Z/]+)\s([A-Z/]+)\s([A-Z/]+)\s([A-Z/]+)\s\] |&$do_the_change_mon("$1_$2_$3_$4)|xe;
Thank you all for your kind answers, monks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Substituting in the substitution!
by diotalevi (Canon) on May 06, 2004 at 17:57 UTC |