in reply to Re^3: regex at word boundary
in thread regex at word boundary
Regarding the length $^N > 1 test, I added that because while refining this RE I discovered that it was capable of considering a single-character string to be palindromic (new word?), since "a" in reverse is still "a".
Update: Now that I think about it, the length $^N > 1 test is better written as ..+ earlier in the RE, like this:
qr/(..+) (??{ ( lc $^N eq reverse lc $^N ) ? '' : '(?!)' }) /ix
...thus forcing at least two characters to be tested in the first place, rather than hand-coding a test for two or more characters via 'length'. Duh!
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: regex at word boundary
by QM (Parson) on Dec 08, 2005 at 05:25 UTC |