in reply to use Switch wierdness

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/g
You’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

Replies are listed 'Best First'.
Re^2: use Switch wierdness
by tqisjim (Beadle) on Aug 27, 2012 at 13:43 UTC
    tuoche!