Re: Phonetic speller function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I looked at the 'sound like' modules in php (leveshtien, soundex) but they are 
for comparing 2 strings, not creating a string based on what we already have. 

I see that str_replace supports regular expessions. Without devoting hours 
learning to write a regex, would it be inappropriate for me to ask how would 
a regex look that basically says to str_replace "replace the n-th occurence 
of $was with $willbe" and then I could just loop n==1 n==2 until 
n==substr_count($data, $was);

Did I mention how much I appreciate your help in this matter? I am very 
impress with the wealth of information the php community is willing to share.

Dotan

On Monday 17 January 2005 04:41 am, Richard Lynch wrote:
> Dotan Cohen wrote:
> > kayak. Focusing only on the 'k's I get this array: kayak, cayac. But I
> > need
> > kayak, kayac, cayak, cayac.
>
> You may (or may not) be able to get something going with that extra
> optional last argument to str_replace which tells how many characters to
> replace.
>
> str_replace('k', 'c', 'kayak', 1) ==> cayak
>
> You probably should step back and use soundex, or one of the other "sound
> like" modules in PHP as Greg suggested though, as a word with THREE k's in
> it will maybe be too much hassle...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux