Hi

I am having trouble understanding how the pre_replace function works.

I am using a script which has the following line:

$ret = preg_replace("#(@|telefone|e-mail|.com|skype|.com.br|fone|www.|hotmail|yahoo|ig|aol|uol|gmail|bol|msn|MSN)#i", "\\1scriptolutionreplacement", $ret);

What is happening is that any word with for example the letters ig or uol in it is getting caught. Is there a way to alter this line so that it is only unique/complete word such as ig or uol that are amended?

Hope this makes sense and thank you in advance for any advice.

Regards
Mark

You can use \b as word boundary before and after the word you want to match.

Thank you very much - worked perfectly.

Regards
Mark

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.