#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^(?=\# ?\d+\.)"
Local $sString = "# This is a comment <-beacuse it starts at the begining of the file" & @CRLF & _
"# This is a comment <- see above" & @CRLF & _
"# 1. Item one <- not a comment because it starts with 1." & @CRLF & _
"# Description of Item 1 <- not a comment as it is after a line that starts with a number" & @CRLF & _
"data point 1" & @CRLF & _
"data point 2" & @CRLF & _
"data point etc" & @CRLF & _
"3 <-- represents number of data points under Item one" & @CRLF & _
"" & @CRLF & _
"# 2. Item two <-- not a comment" & @CRLF & _
"# Description of item 2 <-- not a comment" & @CRLF & _
"data point 1" & @CRLF & _
"data point .." & @CRLF & _
"data point 100" & @CRLF & _
"100" & @CRLF & _
"#3. Item three <--- not a comment" & @CRLF & _
"# Item three description" & @CRLF & _
"0"
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