Aurgh! Please help.
I have a variable $var which is contains either a word or phrase and a variable $paragraph which contains a paragraph. I want to substitute all the occurance or $var preceeded and followed by a space with a third variable $replace ignoring case.
I'm trying something like:
$paragraph = eregi("[[:space:]]$var[[:space:]]", $replace, $paragraph);
which isn't working. Better yet, I'd like to do the replacement if the $var is at the beginning or end of the $paragraph and if it is followed by a ., or :
So I thought I could do:
$paragraph = eregi("(|[[:space:]])$var([[:space:]]|.|\,|$", $replace, $paragraph);
Which also doesn't work.
I've read and reread the php.net doc's on reg ex and all the reg commands. This should be easy. What am I doing wrong?
THanks in advance for anyone that can help!