Here is my problem:
Using preg_replace('@\b(word)\b@','****',$text);
Where in text I have word\word and word
, the preg_replace
above replaces both word\word
and word
so my resulting string is ***\word and ***
.
I want my string to look like : word\word and ***
.
Is this possible? What am I doing wrong???
LATER EDIT
I have an array with urls, I foreach that array and preg_replace the text where url is found, but it's not working.
For instance, I have http://www.link.com and http://www.link.com/something
If I have http://www.link.com it also replaces http://www.link.com/something.