I have a following example:
<strong><span style="text-decoration: underline;">LAbel<br>
</span></strong>
<span style="color: #1f497d;">Label:</span>
[[<span href="#" style="background: red; color: white;" field-id="97c97578-ac1b-4495-a3a7-85e75d0acf40"> some text ... </span>]]
[[<span href="#" style="background: red; color: white;" field-id="db983948-6458-4be8-9044-174093d39976"> some other text ... </span>]]<br>
I need to find and replace a snippet like:
[[<span somestyle_and_attributes field-id="some GUID"> some random text </span>]]
In my example I want to find and replace this:
[[<span href="#" style="background: red; color: white;" field-id="db983948-6458-4be8-9044-174093d39976"> some other text ... </span>]]
My pattern is:
\[\[<span .+? field-id="db983948-6458-4be8-9044-174093d39976">.+?</span>\]\]
But since I want regex to find a match starting from the GUID and field-id and go a little bit back (till the closest left [[span) it also include the preceding span tag.
I can include everything between opened span tag to the pattern (styles, attributes etc), but I feel like there is much simpler way to find the left closest match.