in reply to Re: Regexp substitution using variables
in thread Regexp substitution using variables
Thank you to all of you who have suggested the form s/(?$flags:$pattern)/$replacement/. I think this will get me much of what I need. The fact that the global-replace flag "g" doesn't work in this position is an annoying wrinkle, but I am going to take a deep breath and code up the with-g and without-g cases separately, depending on whether or not $flags =~ s/g// succeeds.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Regexp substitution using variables
by LanX (Saint) on Nov 26, 2020 at 00:40 UTC | |
Re^3: Regexp substitution using variables
by bart (Canon) on Nov 28, 2020 at 11:49 UTC | |
Re^3: Regexp substitution using variables
by MikeTaylor (Acolyte) on Nov 25, 2020 at 22:36 UTC | |
by LanX (Saint) on Nov 25, 2020 at 23:56 UTC | |
by MikeTaylor (Acolyte) on Nov 26, 2020 at 10:34 UTC | |
Re^3: Regexp substitution using variables
by Bod (Parson) on Nov 25, 2020 at 22:32 UTC | |
by MikeTaylor (Acolyte) on Nov 25, 2020 at 22:48 UTC |
In Section
Seekers of Perl Wisdom