Regular Expression for adding an attribute inside an anchor tag
I'm using the WordPress plugin Search Regex. My goal is to add rel=sponsored attributes to all links with a certain domain name and pattern. The plugin has 2 fields (global search and global replacement pattern).
Search should be for:
<a href="https://www.booking.com/anystringhere" rel="sponsored">
anystringhere is always different and can contain anything. So, between <a href="https://www.booking.com/ and the next " is always something different. Basically the whole anchor tag shouldn't be touched, except adding the sponsored attribute.
Could someone provide me with the correct regex for the search field and the replacement field?
Is it possible to add a condition? Some anchor tags already have rel="sponsored" attribute inside and I'd like to skip these.