Anagrams anyone?

6 views
Skip to first unread message

Mike

unread,
Aug 30, 2009, 3:43:37 PM8/30/09
to Regex
I'm trying to build (or find) a regular expression that I can use in a
MySQL db query (with the REGEXP operator) to find anagrams within a
table of words. For example, given "CAT", I'd like the result to be:

A
AT
TA
CAT
TAC
ACT

Any ideas?

Thanks!

Jon

unread,
Aug 31, 2009, 7:19:58 AM8/31/09
to Regex
Yeah, I don't think you can do that with a regular expression...unless
you defined every single word in the dictionary in your expression.
You'd be better off getting the word from the DB, then using something
like http://sourceforge.net/projects/phpag/ to find the anagrams.
Reply all
Reply to author
Forward
0 new messages