#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?mxJ)(?<li_all>" & @CRLF & _
" (?<li_lead_line>\n)?" & @CRLF & _
" (?<li_lead_space>^[ \t]*)" & @CRLF & _
" (?<list_type_any>" & @CRLF & _
" (?:" & @CRLF & _
" (?:" & @CRLF & _
" (?<list_type_unordered_star>(?&list_unordered_star))" & @CRLF & _
" |" & @CRLF & _
" (?<list_type_unordered_minus>(?&list_unordered_minus))" & @CRLF & _
" |" & @CRLF & _
" (?<list_type_unordered_plus>(?&list_unordered_plus))" & @CRLF & _
" )" & @CRLF & _
" |" & @CRLF & _
" (?<list_type_ordered>(?&list_ordered))" & @CRLF & _
" )" & @CRLF & _
" )" & @CRLF & _
" [ \t]*" & @CRLF & _
" (?<li_content>(?s:.*?)" & @CRLF & _
" (\n{1,2}))" & @CRLF & _
" (?= \n*" & @CRLF & _
" (" & @CRLF & _
" \z" & @CRLF & _
" |" & @CRLF & _
" \g{li_lead_space}" & @CRLF & _
" (?<list_type_any2>" & @CRLF & _
" (?:" & @CRLF & _
" (?:" & @CRLF & _
" (?<list_type_unordered_star2>(?&list_unordered_star))" & @CRLF & _
" |" & @CRLF & _
" (?<list_type_unordered_minus2>(?&list_unordered_minus))" & @CRLF & _
" |" & @CRLF & _
" (?<list_type_unordered_plus2>(?&list_unordered_plus))" & @CRLF & _
" )" & @CRLF & _
" |" & @CRLF & _
" (?<list_type_ordered2>(?&list_ordered))" & @CRLF & _
" )" & @CRLF & _
" )" & @CRLF & _
" [ \t]*" & @CRLF & _
" )" & @CRLF & _
" )" & @CRLF & _
")" & @CRLF & _
"(?(DEFINE)" & @CRLF & _
" (?<list_unordered_star>" & @CRLF & _
" [\*]" & @CRLF & _
" (?!" & @CRLF & _
" (?:" & @CRLF & _
" [ ]?[\*][ ]?" & @CRLF & _
" ){2,}" & @CRLF & _
" )" & @CRLF & _
" )" & @CRLF & _
" (?<list_unordered_minus>" & @CRLF & _
" [\-]" & @CRLF & _
" (?!" & @CRLF & _
" (?:" & @CRLF & _
" [ ]?[\-][ ]?" & @CRLF & _
" ){2,}" & @CRLF & _
" )" & @CRLF & _
" )" & @CRLF & _
" (?<list_unordered_plus>[\+])" & @CRLF & _
" (?<list_ordered>\d+[\.])" & @CRLF & _
")"
Local $sString = "* JKL" & @CRLF & _
" 1. JKL-1" & @CRLF & _
" 2. JKL-2" & @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