I'm also an idiot ...
Something else, the "or" output is occurring because the exception "the"
matches "other " first so "other" becomes "or" minus the "the"...
So heres what I did ...
$search = array( '/\bthe\b/', '/\bother\b/', '/\bthat\b/', '/\ba\b/' );
$string = 'The other lady that laughed'
> From: "Chris Boget" <[EMAIL PROTECTED]>
> Is there a way to replace/remove *whole* words from a
> phrase? For example:
[snip]
> $stringToParse = str_replace( $exceptionPhrase, '', trim(
> $stringToParse ));
Try this instead of str_replace()
$stringToParse =
preg_replace("/(^|\\W){$exce
> The case is what's stopping it from working
> a str_replace(strtolower($exceptionphrase) , '' ,
> strtolower($stringtoparse)) would take the case out of the equation
No, that didn't entire quite work, either. The result from this
change is "or ldy lughed" and not the desired result of "lady
la
The case is what's stopping it from working
a str_replace(strtolower($exceptionphrase) , '' , strtolower($stringtoparse))
would take the case out of the equation
and for php5 theres always the case insensitive version
str_ireplace()
-David
>
> From: "Chris Boget" <[EMAIL PROTECTED]>
> Date: 20
4 matches
Mail list logo