#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "box(?!-shadow) "
Local $sString = "positive lookahead" & @CRLF & _
"box(?=-shadow)" & @CRLF & _
"" & @CRLF & _
"https://youtu.be/aIEjh0YsxWA?t=309" & @CRLF & _
"// select box only if what comes after it IS -shadow" & @CRLF & _
"" & @CRLF & _
"box-sizing" & @CRLF & _
"shape-shadow" & @CRLF & _
"------------------------------------------------------------------" & @CRLF & _
"negative lookahead" & @CRLF & _
"box(?!-shadow) " & @CRLF & _
"" & @CRLF & _
"// select box only if what comes after it IS NOT shadow" & @CRLF & _
"" & @CRLF & _
"box-sizing" & @CRLF & _
"shape-shadow" & @CRLF & _
"" & @CRLF & _
"------------------------------------------------------------------" & @CRLF & _
"negative look behind" & @CRLF & _
"(?<!jeffery).+" & @CRLF & _
"" & @CRLF & _
"https://youtu.be/aIEjh0YsxWA?t=212" & @CRLF & _
"// this string cannot come before the @" & @CRLF & _
"" & @CRLF & _
"jeffrey@envato.com" & @CRLF & _
"joe@envato.com" & @CRLF & _
"" & @CRLF & _
"------------------------------------------------------------------" & @CRLF & _
"positive look behind" & @CRLF & _
"(?<=box-)sizing" & @CRLF & _
"" & @CRLF & _
"https://youtu.be/aIEjh0YsxWA?t=337" & @CRLF & _
"// only want to select 'sizing' if what comes before it is 'box' " & @CRLF & _
"// select sizing as long as what comes before it is 'box'" & @CRLF & _
"" & @CRLF & _
"box-sizing" & @CRLF & _
"shape-sizing" & @CRLF & _
"" & @CRLF & _
"------------------------------------------------------------------" & @CRLF & _
"" & @CRLF & _
"negative look behind" & @CRLF & _
"(?<!box-)sizing" & @CRLF & _
"" & @CRLF & _
"// anything can come before it except 'box'" & @CRLF & _
"" & @CRLF & _
"box-sizing" & @CRLF & _
"shape-sizing" & @CRLF & _
"" & @CRLF & _
"-----------------------------------------------------------------" & @CRLF & _
"positive lookahead " & @CRLF & _
"@.+(?=\.[a-z]{2,4})" & @CRLF & _
"" & @CRLF & _
"// Matches a group after your main expression without including it in the result" & @CRLF & _
"" & @CRLF & _
"wilson@gmail.com" & @CRLF & _
"frank@france.fr" & @CRLF & _
"joe@paris.france" & @CRLF & _
"" & @CRLF & _
""
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