Regular Expression Function
- From: axrock <chris.sefton@xxxxxxxxx>
- Date: Sat, 27 Dec 2008 15:43:33 -0800 (PST)
Hello,
I am not to good with regular expressions and was hoping somebody
could provide me some help to create a function to do the following...
I want a regular expression to compare sentences and then rate them as
a percentage.
IE:
A user types: "Hello, how are you today"
I have an array (or mysql data) with a list of other phrases like so..
1. How are you today
2. Hi, how are you today
3. What is the time
4. What are you doing today
5. Hello how are you today
5. etc
I need the regular expression to compare the string entered by the
user and then return a list from the array rating them as a percentage
of the closest match.
IE: I would assume in this case that number 5 would rate the highest
(100% match) followed by number 2 then number 1.
I don't need to worry about punctuation like commas or quotes etc.
These will be stripped from the input first.
If anybody knows a way to do this it would be greatly appreciated.
Is a regular expression the way to go, or should I be investigating
some other method?
Many thanks!
.
- Follow-Ups:
- Re: Regular Expression Function
- From: Jerry Stuckle
- Re: Regular Expression Function
- Prev by Date: Re: Regular Expression Function
- Next by Date: Re: Regular Expression Function
- Previous by thread: chinese pinyin
- Next by thread: Re: Regular Expression Function
- Index(es):
Relevant Pages
|