Hello, gurus!
As I can see this question is very important for lot of developers and of course for me. So let's join our efforts to resolve this.
So. We have HTML source code like this.
.... <tag1> <tag2>...</tag2>
some text to replace or Replace or replaceme
<tagN>... </tagN> some text here ...
and so on. This is a arbitrary source.
Also we have dictionary with pair of words, for example
$pattern = ("replace", "text", ....)
$replace = ("rpl", "txt", ...)
it means that we should find all whole words "replace" and replace them to "rpl", find all whole words "text" and replace them to "txt" and so on.. OUT OF HTML TAGS!
This task looks like a little web translator word-by-word.
So. The question. How can I solve this task? This translator should work VERY VERY fast. Much faster than preg_replace with two arrays on whole html source.
Thanks!