I am writing some code to create a google base feed and I need to remove all of the ®, ™ etc from the product descriptions. My problem is that I need a regular expression that I can use to look for the pattern: & [any series of characters]; (ampersand[any characters] semicolon). Can anyone help with this regular expression?


$reg = '/(&.*?;)/is';
$data="&reg; This is a registered company. &nbsp; &gt; &lt; is replaced by a whitespace.";
echo preg_replace($reg,$rep,$data);

This is an example in php. $reg is the pattern that you want to search for. $data is a string which you want to search for the pattern. $rep is 'what' you want to replace $reg with.
I dont know much about the syntax of regex in .net, but the logic remains the same.

Hope it helps.

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.