ultranerds has asked for the wisdom of the Perl Monks concerning the following question:
If I run this, I get:my $test = qq|Some test. This is a test-with a dash. We want to match +test here|; $test =~ s{\b(test)\b}{change_for_url($1)}eg; sub change_for_url { print "GOT: '$_[0]'\n"; }
GOT: 'test' GOT: 'test' GOT: 'test'
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Regex boundary match (updated demo code)
by LanX (Saint) on Feb 08, 2020 at 14:00 UTC | |
by ultranerds (Hermit) on Feb 08, 2020 at 14:08 UTC | |
by AnomalousMonk (Archbishop) on Feb 08, 2020 at 15:55 UTC | |
Re: Regex boundary match
by AnomalousMonk (Archbishop) on Feb 08, 2020 at 21:50 UTC | |
Re: Regex boundary match
by ultranerds (Hermit) on Feb 08, 2020 at 13:57 UTC | |
by LanX (Saint) on Feb 08, 2020 at 14:10 UTC | |
by ultranerds (Hermit) on Feb 08, 2020 at 14:24 UTC |