David Green wrote:
On 2010-08-05, at 8:27 am, 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.

I think conceptually the beginning and the end of a string feels like a
bracketing construct (only without symmetrical symbols).  At least that seems
to be my instinct.  Well, it doesn't in / ^foo | ^bar | ^qux /, but in
something like /^ foo|bar $/, the context immediately implies a higher
precedence for ^ and $.  Maybe something like // foo|bar // could work as a
bracketing version?

Personally, I had always considered the ^ and $ to be the lowest precedence things in a pattern. But I can understand the flexibility one gains from that not being so, having seen David's example here, which it never occurred to me before was possible. -- Darren Duncan

Reply via email to