in reply to The "anchor" misnomer in regexes

Agreed with the above two, that the problem is in what some people think is implied by the term "anchor."

If you think the anchor is a "starting place" on which the regex algorithm should work, then you will definitely get confused about /\s+$/ and other examples you've shown. The ability of some regex parsers to get a performance enhancement by noticing that the regex ends with an easy-to-find constraint has nothing to do with the syntax of the forward-matching operation.

Maybe this is a bit whimsical, but I've never thought of an anchor as the starting place for traversing a ship, so maybe this is why I've never been confused about anchors with regards to reverse-processing of regular expressions. Only the crabs and rats would consider an anchor as an entrypoint. The sailors surely think of an anchor as a restraint on the usual forward-moving operation of the ship.

--
[ e d @ h a l l e y . c c ]

Replies are listed 'Best First'.
Re^2: The "anchor" misnomer in regexes
by TimToady (Parson) on Dec 16, 2005 at 18:08 UTC
    Actually, I expect a sailor would think of the anchor as preventing backward motion of the ship, since the anchor hangs off the bow and causes the ship to point into the wind and/or current.