in reply to 'g' flag w/'qr'
Adverbs modify how regexes work and give very convenient shortcuts for certain kinds of recurring tasks.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.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.
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 |