#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(.* ? J .*)"
Local $sString = "J00*" & @CRLF & _
"J01*" & @CRLF & _
"J02*" & @CRLF & _
"J03*" & @CRLF & _
"J04*" & @CRLF & _
"J05*" & @CRLF & _
"J06*" & @CRLF & _
"J07*" & @CRLF & _
"J08*" & @CRLF & _
"J09*" & @CRLF & _
"J10*" & @CRLF & _
"J11*" & @CRLF & _
"J12*" & @CRLF & _
"J13*" & @CRLF & _
"J14*" & @CRLF & _
"J15*" & @CRLF & _
"J16*" & @CRLF & _
"J17*" & @CRLF & _
"J18*" & @CRLF & _
"J19*" & @CRLF & _
"J20*" & @CRLF & _
"J21*" & @CRLF & _
"J22*"
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYFULLMATCH)
; 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