Again, I've stumbled about a "make it more elegant?"-problem: Actually this time it is more a "keep it generic?" type of a problem.
I have a list of strings (words/phrases.) With reverse and a little looping, it is simple to find those, that are symmetric, i.e. spelled forward and backward alike.
The problem is now, that I use a generic regexp-search within this wordlist to find special entries fitting - well - what an regexp can fit.
It would be cool to reuse this regexp search for the forward/backward test, but I don't know how resp. if this is even possible.
My guess is, that it is not possible with an regexp for words of arbitrary length, as this problem seems to be quite similar to that of balanced parentheses. But then again I might be wrong, as this could be a special case.
Enlightenment anyone?
Bye
PetaMem All Perl: MT, NLP, NLU
In reply to Reverse a Word - without reverse?? by PetaMem
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |