Re: How do I remove a string from another string in a fuzzy way?

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

 



On May 20, 2013, at 10:17 PM, Daevid Vincent <daevid@xxxxxxxxxx> wrote:
Initially I was thinking that somehow I could use a simple regex on the
> needle and haystacks to strip out all white space and str_ireplace() them
> that way, but then I don't have a way to put the whitespace back that I can
> see.

Daevid:

Go ahead and strip out the whitespace, but replace it with a delimiter string that is unique and then don't consider that delimiter when comparing strings to strings.

Afterwards, if you want to keep the string (instead of deleting it), then reverse the process adding back in the whitespace and removing the delimiter.

Also, you may want to look into using array_unique() for comparing groupings of several strings (i.e., paragraphs) to other groupings. It works pretty slick for me.

Cheers,

tedd

_____________________
tedd.sperling@xxxxxxxxx
http://sperling.com


-- 
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