I have a column containing the html for page_content.
With my limited knowledge on SQL I can only find external links or links that have rel="nofollow" in them.
But I need help to find the links which are external and doesn't have the rel="nofollow" attribute and possible add it.
Lorem ipsum <a href="http://own-domain.com">dolor</a> sit amet, consectetur adipiscing elit.
Cras mi lacus, <a href="http://external-domain.com">**mattis**</a> vel rutrum lobortis, pharetra in elit. Praesent consequat <a rel="nofollow" href="http://own-domain.com">condimentum</a> diam ut sodales.
I want to add nofollow attribute to mattis , taking care not to add it to own-domain or adding nofollow twice on condimentum.
UPDATE : Note, that I need to do this on the database of a custom CMS like wordpress. My pages are rendered in PHP. I can modify the source while content load. But I prefer to do this in the database layer to make it permanent.