in reply to 'g' flag w/'qr'

What several monks have been trying to explain might be clearer in the Perl 6 documentation on regexes and adverbs (https://doc.perl6.org/language/regexes#Adverbs). Perl 6 adverbs, in regex context, are essentially the equivalent of Perl 5 regex modifiers. This documentation says:

Adverbs modify how regexes work and give very convenient shortcuts for certain kinds of recurring tasks.

There are two kinds of adverbs: regex adverbs apply at the point where a regex is defined and matching adverbs apply at the point that a regex matches against a string.

(...)

Adverbs that appear at the time of a regex declaration are part of the actual regex and influence how the Perl 6 compiler translates the regex into binary code.

(...)

In contrast to regex adverbs, which are tied to the declaration of a regex, matching adverbs only make sense while matching a string against a regex.

OK, I know you are talking of Perl 5, but I think that these explanations clarify the distinction between modifiers which apply to a regex definition and modifiers which apply to the matching process.

If you look at the two lists of adverbs, you will see that the equivalent of the g modifier would fit into the matching adverbs category, the equivalent of the :i adverb will be a regex modifier, and :sigspace, the symmetrical counterpart of the x modifier, is a matching adverb.

I hope this makes sense.

Update; s/^What several months have/What several monks have/. Thanks to AnomalousMonk and LanX for pointing out the typo.

Replies are listed 'Best First'.
Re^2: 'g' flag w/'qr'
by perl-diddler (Chaplain) on May 30, 2016 at 01:52 UTC
    Makes sense, but given that they are usually mixed together at the end of an /RE/<options>, it's not readily apparent that they are different. Too bad perl5 couldn't have directly grown into perl6 (somehow?!)...