I have a text… and in it I have paragraphs and tables… I need to replace every X (a single Japanese kanji character to be precise… but it could be any character) which is in one of the tables with <a href="http://example.com/#X">X</a>, but only those X that are in the tables, not outside of them.
There can be several X in a single table so preg_replace('#<td>(X)#','replacewith',$source) wouldn’t work as it replaces only one of the X.
Any ideas? Thanks.
Edit: fixed, tested, works.