On Mon, Feb 6, 2012 at 11:04 PM, Eric Brine <ikegami@adaelis.com> wrote: > On Mon, Feb 6, 2012 at 9:23 PM, demerphq <demerphq@gmail.com> wrote: ... > >> And yes of course Perl complains >> >> when you use a modifier which controls how the match is performed on a >> pattern constructor which does not actually do any matching. > > > That's good. That's what I would expect. The problem is that perlre lumps > "g", "c" and "p" into the documentation for regex pattern compilation flags. > >> I find the term "regex flags" to be ambiguous and "Regex pattern >> flags" to only be marginally better. Some of the terms I have used >> elsewhere in this thread are equally bad. Since this ambiguity seems >> to lead to confusion, lets try to come up with better terms. :-) > > > perlre simply calls them "modifiers" and "flags modifiers". The re pragma > calls them "flags" and "modifiers". It could definitely be improved. > >> --------------------------------------------- >> 1. Pattern semantics flags: /m /i /s /u /d /l /a >> >> These modifiers change the meaning of specific meta-character, or >> literal text. These apply to qr//, m// and s/// >> >> 2. Pattern compilation flags: /x /o >> >> These patterns change the process by which a pattern is compiled. /x >> does so by causing the regex compiler to ignore specific parts of the >> pattern passed in, and /o by determining how often it gets compiled. >> These apply to qr//, m// and s/// >> >> >> 3. Match control flags: /g /c >> >> These control how the matching is to proceed, and only apply to m// and >> s///. >> >> 4. Substitutions flags: /e /r >> >> These control the behavior of the substitution operator, and apply only to >> s/// >> >> >> --------------------------------------------- >> >> Unfortunately this leaves /p out > > > Sounds good. A few comment/nits: > > I'm not sure a distinction is needed between (1) and (2), and it will lead > to having to the following mouthful: "(?:) accepts pattern semantic flags > and pattern compilation flags". While (1) and (2) could be grouped together by what they can apply to; I think it would be quite hard to come up with a phrase to describe them that doesn't also include any of the other flags. The phrase: Pattern semantics flags is very unambiguous as to what is included in that group. If you wanted to describe both (1) and (2): "(?:) accepts pattern semantic, and compilation flags" I would like to note that the important words from (1) and (2) are "semantic" and "compilation" Also there is actually a difference between (1) and (2), the flags from (1) can be applied with "(?i:)" The flags from (2) can only be applied to the whole pattern/match/substitution. ( Perhaps we should refer to qr// as a pattern. Just a random thought. ) > perlop lists /ee in addition to /e, so /ee should be listed explicitly here. If we do refer to /ee, perhaps we should note that you can append as many /e's as you want. > Because of where it can be used, I'd place /p under (2). (I believe it > should be in (3), but that's not how it was implemented.) I agree with this.Thread Previous | Thread Next