#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(warning|error|note|help)(?:\[(.*)\])?\: (.*)\s+--> (.*):(\d+):(\d+)\n(?:((?:.+\n)+)\.+)?(?:[\d\s]+\|.*)*((?:\s+=.*)+)?"
Local $sString = "Compiling sample v0.1.0 (file:///home/sample/src/sample.rs)" & @CRLF & _
"error: cannot borrow immutable local variable `buffer` as mutable" & @CRLF & _
"--> src/sample.rs:29:32" & @CRLF & _
"|" & @CRLF & _
"26 | let buffer = String::new();" & @CRLF & _
"| ------ use `mut buffer` here to make mutable" & @CRLF & _
"..." & @CRLF & _
"29 | while ifile.read_line(&mut buffer).unwrap() > 0 {" & @CRLF & _
"| ^^^^^^ cannot borrow mutably" & @CRLF & _
"" & @CRLF & _
"error: cannot borrow immutable local variable `buffer` as mutable" & @CRLF & _
"--> src/sample.rs:39:9" & @CRLF & _
"|" & @CRLF & _
"26 | let buffer = String::new();" & @CRLF & _
"| ------ use `mut buffer` here to make mutable" & @CRLF & _
"..." & @CRLF & _
"39 | buffer.clear();" & @CRLF & _
"| ^^^^^^ cannot borrow mutably" & @CRLF & _
"" & @CRLF & _
"error[E0384]: re-assignment of immutable variable `buffer`" & @CRLF & _
"--> src/sample.rs:30:9" & @CRLF & _
"|" & @CRLF & _
"26 | let buffer = String::new();" & @CRLF & _
"| ------ first assignment to `buffer`" & @CRLF & _
"..." & @CRLF & _
"30 | buffer = buffer.replace("\n", "");" & @CRLF & _
"| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ re-assignment of immutable variable" & @CRLF & _
"" & @CRLF & _
"error: aborting due to 3 previous errors" & @CRLF & _
"" & @CRLF & _
"error: Could not compile `sample`." & @CRLF & _
"" & @CRLF & _
"To learn more, run the command again with --verbose."
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