in reply to The "anchor" misnomer in regexes
How does your idea of anchors hold when there are more than one? It is easy to see that $string =~ /#(.*?)$/ could be processed as reverse $string =~ /^(.*?)#/ and it would then produce very different and perhaps more intuitive results. But what would you then do with $string =~ /^#(.*?)$/ .. now your anchor would seem to mean different things and behave differently based on the number of anchors. The current anchors hold well enough and arn't so confusing once you get used to it. After all, find a #, take everything after that up to the end of the line, is pretty straight forward. More so than, take your string, start at the end, and find the first # sign. Which you'll notice is the reverse order of the actual regex so you would have to read it backwards.
Just my two cents.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: The "anchor" misnomer in regexes
by dragonchild (Archbishop) on Dec 17, 2005 at 05:22 UTC | |
by eric256 (Parson) on Dec 18, 2005 at 01:56 UTC |