Entry
I want to replace 'and' with 'or' in a string but want it to only work on whole words. eg not 'sand'
Aug 17th, 2002 15:38
Nate Weibley,
I think you want this....
<?php
$string='One day in the sand my brother asked me "Do you want a coke
and a sandwhich?" I said "I dont, but ask Mr. Sanders, and."';
$string=eregi_replace([^a-z0-9]+)and([^a-z0-9]
+)",'\\1or\\2',$string); //Meaning replace nonalphanumeric, then the
sequence of letters and, then another nonalphanumeric with or...
keeping the surrounding chars
echo $string;
?>
I hope thats what you wanted
--Nate
iamfast@tampabay.rr.com