#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?mi)(?<!\<a\shref)my(?!.*\<\/a\>)"
Local $sString = "This is a sample my text <a href="https://test.com">test my stuff</a> with my inside <a href="https://mytest.com">test me</a> brackets and my outside brackets oh my . <a href="https://test.com">test my stuff</a> not sure why my instances of my before the last lookahead doesnt work?" & @CRLF & _
"" & @CRLF & _
"Intent: I have an FAQ that uses js to highlight words on the page by letter as you type. I need to ignore the HREF entries in the replace function as the injection of a class to highlight the typed letters/words replaced within the HREF messing up the link. " & @CRLF & _
"" & @CRLF & _
"Incorrectly Ignoring position 18, 76, 141, 164" & @CRLF & _
"Correctly ignoring position 58, 104 and 201" & @CRLF & _
"Correctly finding position 227, 242"
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYGLOBALFULLMATCH)
Local $aFullArray[0]
For $i = 0 To UBound($aArray) -1
_ArrayConcatenate($aFullArray, $aArray[$i])
Next
$aArray = $aFullArray
; Present the entire match result
_ArrayDisplay($aArray, "Result")
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm