I have many html documents, I need to replace the text "foo" to "bar" in all documents, except in links
For example
foo<a href="foo.com">foo</a>
should be raplaced to
bar<a href="foo.com">bar</a>
the url in the link (foo.com) should be left untouched.
The same case in image links and links to javascripts or stylesheets, only the text should be replaced, the urls should be unchanged.
Any ideas for a nice regex or something ? :)
I can use Ruby too :)