#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(?:\bchapters?|c+)\s*((?:\s*([,&+]|and)?\s*(?:chapter|c)?\s*\d+(?:\.\d+)?(?:\s*-\s*(?:chapter|c)?\s*\d+)?)+)"
Local $sString = "$title[] = 'c19 & c20'; " & @CRLF & _
"$title[] = 'text c19 & c20 text'; " & @CRLF & _
"$title[] = 'text chapter 19 and chapter 25 text'; " & @CRLF & _
"$title[] = 'text chapter 19 - chapter 23 and chapter 25 text'; " & @CRLF & _
"$title[] = 'text chapter 19 - chapter 23, chapter 25 text'; " & @CRLF & _
"$title[] = 'text chapter 23 text'; " & @CRLF & _
"$title[] = 'text chapter 23, chapter 25-29 text'; " & @CRLF & _
"$title[] = 'text chapters 23-26, 28, 29 + 30 + 32-39 text'; " & @CRLF & _
"$title[] = 'text chapter 25.6 text'; " & @CRLF & _
"$title[] = 'text chapters 23, 24, 25 text'; " & @CRLF & _
"$title[] = 'text chapters 23+24+25 text'; " & @CRLF & _
"$title[] = 'text chapter 23, 25 text'; " & @CRLF & _
"$title[] = 'text chapter 23 & 24 & 25 text'; " & @CRLF & _
"$title[] = 'text c25.5-30 text'; " & @CRLF & _
"$title[] = 'text c99-c102 text'; " & @CRLF & _
"$title[] = 'text chapter 1 - 3 text'; " & @CRLF & _
"$title[] = '33 text chapter 1, 2 text 3'; " & @CRLF & _
"$title[] = 'text v2c5-10 text'; " & @CRLF & _
"$title[] = 'text cccc5-10 text'; " & @CRLF & _
"$title[] = 'text chapters 23, 24, 25, 29, 31, 32 text'; " & @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