Just another Perl shrine | |
PerlMonks |
Re^3: regex at word boundaryby QM (Parson) |
on Dec 08, 2005 at 04:50 UTC ( [id://515127]=note: print w/replies, xml ) | Need Help?? |
Very good.
I would point out the existence of (?!), which I'm told always fails, though I'm not sure I understand it. 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 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?) -QM
In Section
Seekers of Perl Wisdom
|
|