#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "\b106\b"
Local $sString = "No match:" & @CRLF & _
"106M" & @CRLF & _
"1106" & @CRLF & _
"106in a string is bad even if it starts the line" & @CRLF & _
"And it may finish with the target but not as the tail of a string106" & @CRLF & _
"" & @CRLF & _
"Match:" & @CRLF & _
"106 something else" & @CRLF & _
"another 106" & @CRLF & _
"And ofcouse "106' will work as well" & @CRLF & _
"I just want 106 to show up but not embedded in other numbers or text" & @CRLF & _
"but it's OK is the end of the line is 106" & @CRLF & _
"106 may also start the line but"
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