I would point out the existence of (?!), which I'm told always fails, though I'm not sure I understand it.'1\b2'
Update 1:
By the way, in my solution I chose to accept palindromes regardless of whether they contain only alpha characters or not.Yes. The OP was looking for multi-word palindromes, perhaps more along the lines of the "interesting to humans" variety, which seems to be what started the thread in the first place.
Update 2: After further examination, your idea could be adapted for intervening whitespace (or indeed any noise characters) if the regex engine was re-entrant (is that with or without the hyphen?). Something like:
which might be further streamlined to(??{ local $N; ($N = $^N) =~ s/\w+//g; (lc $N eq reverse lc $N) ? '' : (?!) })
I think length $^N > 1 is superfluous, as length $^N is sufficient as a test, and (.+) would always be positive anyway (or is there a zero length character that would match?)(??{ local $N; ($N = $^N) =~ s/\w+//g; (?!) if (lc $N ne reverse lc $N) })
-QM
--
Quantum Mechanics: The dreams stuff is made of
In reply to Re^3: regex at word boundary
by QM
in thread regex at word boundary
by mikeraz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |