Re: How do I remove a string from another string in a fuzzy way?
| From: | Tedd Sperling | Date: | Tue, 21 May 2013 16:45:04 +0000 |
| Subject: | Re: How do I remove a string from another string in a fuzzy way? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-321167@lists.php.net to get a copy of this message | ||
On May 20, 2013, at 10:17 PM, Daevid Vincent <daevid@daevid.com> 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@gmail.com
http://sperling.com