MySQL Forums
Forum List  »  Newbie

Re: regexp challenger
Posted by: Rick James
Date: August 31, 2009 07:42PM

Meet the problem in the middle...

ardor - array - arroyo - daddy - dado - dodo - doodad... door - odor
adorr - aarry - aoorry - adddy - addo - ddoo - adddoo... oord - oord

dooryard
addoorry

/^a?d?d?o?o?r?r?y?$/

First pair of lines shows how I would transform each word in the database by sorting the letters. This would lead to a table with two columns -- sorted letters, plus real word. The sorted-letters column would not be quite unique, but that is ok.

The second pair of lines shows the query word similarly transformed.

The regexp should work in Perl and MySQL:
select 'adorr' REGEXP '^a?d?d?o?o?r?r?y?$';

Then you look up 'adorr' to see that it stands for 'ardor'.
'door' is more interesting -> door, odor, rood (3 rows in your new table).

Options: ReplyQuote


Subject
Written By
Posted
August 30, 2009 09:22AM
August 30, 2009 09:34AM
August 30, 2009 05:13PM
August 30, 2009 05:20PM
Re: regexp challenger
August 31, 2009 07:42PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.