#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(?x) # Free spacing mode, to allow comment and better view" & @CRLF & _
"" & @CRLF & _
"# Matching the first line `i5-2520M` (capture group 1)" & @CRLF & _
"([^ ]+\s*)(?=CPU\s*@)" & @CRLF & _
"" & @CRLF & _
"# Matching the first line `2.50GHz` (capture group 2)" & @CRLF & _
"|(?<=CPU\s@)(\s*\d+.\d+GHz)" & @CRLF & _
"" & @CRLF & _
"# Matching the `first word` on the second line. (capture group 3)" & @CRLF & _
"# The `\s*$` is used to not match empty lines." & @CRLF & _
"|(^[^ ]+)(?!(?:.*CPU\s*@)|\s*$) " & @CRLF & _
"" & @CRLF & _
"# Matching the second line `CPU T2400` (capture group 4)" & @CRLF & _
"|(?<=CPU)(\s*[^ ]+\s*)(?=@)" & @CRLF & _
"" & @CRLF & _
"# Matching the second line `1.83GHz` (capture group 5)" & @CRLF & _
"|\s*(?<=@)(\s*\d+.\d+GHz)"
Local $sString = "Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz" & @CRLF & _
"Genuine Intel(R) CPU T2400 @ 1.83GHz" & @CRLF & _
"" & @CRLF & _
"" & @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