raiten has asked for the wisdom of the Perl Monks concerning the following question:
Hi monkers
have a small problem which looks like
http://www.perlmonks.com/index.pl?node_id=366431
i want to make a replacement inline, so a replace in replace
so here is the code
$content =~ s/(\w+)(: *)([^\n]*)\n<xxxxyyxxxx>\n/$1.":".$2.encode_base +64($3,'')."\n"/ges;
for now it doesn't work if $3 contains multiples lines (aka '\n')
first case, rewrite the rule to make replacement on multiple lines. In general i have few success with this.
seconde case, before this code, i decode the code. so there i can replace '\n' with '%%NEWLINE%%' for example and in the above line reverse.
s/%%NEWLINE%%/\n/ is ok, but how can i make it in the previous line ?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: inline replacement in existing regex
by tall_man (Parson) on Nov 30, 2004 at 20:59 UTC | |
|
Re: inline replacement in existing regex
by duff (Parson) on Nov 30, 2004 at 21:28 UTC | |
by raiten (Acolyte) on Dec 01, 2004 at 06:04 UTC | |
by duff (Parson) on Dec 01, 2004 at 06:45 UTC | |
by raiten (Acolyte) on Dec 04, 2004 at 14:50 UTC |