On Thu, Aug 05, 2010 at 10:27:50AM -0400, Aaron Sherman wrote: > On Thu, Aug 5, 2010 at 7:55 AM, Carl Mäsak <cma...@gmail.com> wrote: > > I see this particular thinko a lot, though. Maybe some Perl 6 lint > > tool or another will detect when you have a regex containing ^ at its > > start, $ at the end, | somewhere in the middle, and no [] to > > disambiguate. > > You know, this problem would go away, almost entirely, if we had a :f[ull] > adverb for regex matching that imposed ^[...]$ around the entire match. Then > your code becomes: > > m:f/<[A..Z]>+|<[a..z]>+/
There's a version of this already. Matching against an explicit 'regex', 'token', or 'rule' automatically anchors it on both ends. Thus: $string ~~ regex { <[A..Z]>+ | <[a..z]>+ } is equivalent to $string ~~ regex { ^ [ <A..Z>+ | <[a..z]>+ ] $ } Pm