#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)(?<!<color=green>|[a-zA-Z0-9])(int|void|float|bool)(?!<\/color>|[a-zA-Z0-9])"
Local $sString = "pulic int Example(float x, bool y, int z)" & @CRLF & _
"{" & @CRLF & _
" return y ? (int)x : z;" & @CRLF & _
"}" & @CRLF & _
"" & @CRLF & _
"public <color=green>int</color> ExamepleAlreadyReplaced(<color=green>float</color> x, <color=green>bool</color> y, <color=green>int</color> z)" & @CRLF & _
"{" & @CRLF & _
" return y ? (<color=green>int</color>)x : z;" & @CRLF & _
"}" & @CRLF & _
"" & @CRLF & _
"public void EdgeCaseKeyWordsInNames()" & @CRLF & _
"{" & @CRLF & _
" var someint = int.MinValue;;" & @CRLF & _
" var somefloat = float.MaxValue;" & @CRLF & _
" var somebool = false;" & @CRLF & _
" var somevoid = () => { };" & @CRLF & _
" " & @CRLF & _
" var int2 = 0;" & @CRLF & _
" var intX = 0;" & @CRLF & _
"}"
Local $sSubst = "<color=green>$1</color>"
Local $sResult = StringRegExpReplace($sString, $sRegex, $sSubst)
MsgBox($MB_SYSTEMMODAL, "Result", $sResult)
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