Re: RFC 166 (v3) Alternative lists and quoting of things
[email protected] (Hugo) Fri, 29 Sep 2000 01:13:36 +0100
| Newsgroups | perl.perl6.language.regex |
|---|---|
| Message-ID | <[email protected]> |
In <[email protected]>, Perl6 RFC Librarian writes: :The basic idea is to expand an array as a list of alternatives. There :are two possible syntaxs (?@foo) and just plain @foo. @foo might just have :existing uses (just), therefore I prefer the (?@foo) syntax. That needn't be a problem, that's why all RFCs have a migration section. :) :(?@foo) is just syntactic sugar for (?:(??{ join('|',@foo) })) A bracketed :list of alternatives. Is this not constructed at regexp compile time? If so, it is more like @{[ join('|',@foo) ]}. :Suggested syntax: : :(?Q$foo) Quotes the contents of the scalar $foo - equivalent to :(??{ quotemeta $foo }). : :(?Q@foo) Quotes each item in a list (as above) this is equivalent to :(?:(??{ join ('|', map quotemeta, @foo)})). : :In this syntax the Q is used as it represents a more inteligent \Quot\E. I think it has been stated before that (?Q is reserved along with other letters for possible regexp flags. Hugo