The g flag tells the match operator and the substitution operator to match repeatedly. It makes no sense to use on other operators that do not performing any matching (such as q, qq, qr, qx and tr).
| Option | Pertains to | (?:) | qr// | m | s | tr |
|---|---|---|---|---|---|---|
| m | meaning of regular expression pattern | Yes | Yes | Yes | Yes | |
| s | meaning of regular expression pattern | Yes | Yes | Yes | Yes | |
| i | meaning of regular expression pattern | Yes | Yes | Yes | Yes | |
| x | meaning of regular expression pattern | Yes | Yes | Yes | Yes | |
| p | meaning of regular expression pattern | Yes | Yes | Yes | Yes | |
| a/d/l/u | meaning of regular expression pattern | Yes | Yes | Yes | Yes | |
| n | meaning of regular expression pattern | Yes | Yes | Yes | Yes | |
| o | compiling of regular expression patterns | Yes | Yes | Yes | ||
| c | matching of regular expression patterns | Yes | Yes | |||
| g | matching of regular expression patterns | Yes | Yes | |||
| e | replacement expression | Yes | ||||
| ee | replacement expression | Yes | ||||
| r | input modification | Yes | Yes | |||
| c | transliteration | Yes | ||||
| d | transliteration | Yes | ||||
| s | transliteration | Yes | ||||
The options that pertain to the meaning of regular expression pattern are documented in perlre. The others are documented as part of the documentation of the operators to which they pertain.
In reply to Re: 'g' flag w/'qr'
by ikegami
in thread 'g' flag w/'qr'
by perl-diddler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |