Forum Moderators: coopster

Message Too Old, No Replies

Regex assistance

I thought there was a RegEx forum in here somewhere

         

5x54u

4:48 pm on Nov 30, 2005 (gmt 0)

10+ Year Member



$content = ereg_replace('Widget', 'Widget™', $row['content']);

This works but it is also grabing the possessive version of widget eg. widget's.

How can I apply the TM code to Widget but not Widget's?

TY

dmorison

6:06 pm on Nov 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



$content = ereg_replace('Widget[^\'s]', 'Widget™', $row['content']);

...should do the trick. The hat (^) means anything except the following string; and the backslash is required to escape the apostrophe.

5x54u

8:25 pm on Nov 30, 2005 (gmt 0)

10+ Year Member



Thank you that did it:-)