Hi all,

On 13.07.2014 00:15, David Warring wrote:
> Hi Marc,
> This looks like a Perl 5 complementary character match:  [^:]*
> 
> But it means something quite different in Perl6. From S05
> <http://perlcabal.org/syn/S05.html>
> 
> Bracket rationalization
> <http://perlcabal.org/syn/S05.html#Bracket_rationalization>  [ ... ] is
> no longer a character class. It now delimits a non-capturing group.
> 
> |Changed metacharacters
> <http://perlcabal.org/syn/S05.html#Changed_metacharacters>^| and |$| now
> always match the start/end of a string
> 
> Backtracking control
> <http://perlcabal.org/syn/S05.html#Backtracking_control>To force the
> preceding atom to do no backtracking, use a single |:|
> 
> In summary, this pattern is repeatably matching an empty start-of-string.
> 
> A Perl 6 equivalent is:
> 
>     token gecos { <- [':']>* }

... but without the quotes. In character classes, quotes have no special
meaning, so <-[':']> is the same as <-[:']>, so it excludes the quote
character.

To just exclude the colon, simply say <-[:]>

(Note that the rules of
http://perlcabal.org/syn/S05.html#Simplified_lexical_parsing_of_patterns
about what is and what isn't metacharacter don't apply inside character
classes).

Cheers,
Moritz

Reply via email to