I need to find all occurrences of <a href="somelinke" someattributes > in a text stored in columna and replace it with <a href="somelink" someattributes RRRR> where 'RRRR' is my new attribute. If there is occurence of <a href="somelink" someattributes RRRR>, I do not want to insert another 'RRRR' as it already has it. I just need to leave it. I used negative lookahead regular expression in Java and made it work. But same regular expression doesn't work. Here is what worked in Java and doesn't work in Oracle.
select REGEXP_REPLACE(datacol,'(<a\s+[^>]*href="[^>](?:(?!RRRR).)*?)(>)','\1 "rel=nofollow" \3') from table.