use strict; use warnings; use Test::More; my $in = 'A |simple*example| is |so*simple| to come*up |with these*days| according to some *experts*'; my $exp = 'A |simple-example| is |so-simple| to come*up |with these-days| according to some *experts*'; my $start = qr/\|/; my $stop = qr/\|/; my $got = $in; $got =~ s[ ($start) (.*?) ($stop) ][ "$1" . ( $2 =~ tr/\*/-/r ) . "$3" ]gsxe; is($got,$exp); done_testing;
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
In reply to Re^5: s///g within m//g regions (updated)
by LanX
in thread s///g within m//g regions
by almr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |