in reply to Re^2: Regexp substitution using variables
in thread Regexp substitution using variables

depending on whether or not $flags =~ s/g// succeeds

Testing $flags =~ /g/; is simpler.

Replies are listed 'Best First'.
Re^4: Regexp substitution using variables
by MikeTaylor (Sexton) on Nov 25, 2020 at 22:48 UTC
    Simpler, but doesn't quite do what I need. I want to supply the remaining flags, once g has been removed, in the (?$flags:...) part of the expression. And I need to remove the g so that I don't get flooded with noisy console warnings about how it's being ignored.