The title of this thread reminded me of a quote from the Camel Book (4th Edition, “Lookaround Assertions”, p. 249):
(?<!PATTERN) (negative lookbehind)When the Engine encounters (?<! PATTERN), it looks backward in the string to ensure that PATTERN did not occur.
Let’s go for a really simple example this time. How about the easy version of that old spelling rule, “I before E except after C”? In Perl, you spell it:s/(?<!c)ei/ie/gYou’ll have to weigh for yourself whether you want to handle any of the exceptions. (For example, “weird” is spelled weird, especially when you spell it “wierd”.)
SCNR ;-)
Athanasius <°(((>< contra mundum
In reply to (OT) Re: use Switch wierdness
by Athanasius
in thread use Switch wierdness
by tqisjim
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |