#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^(?P<queryValue>[0-9,./]+) ?(?P<sourceUnit>[a-zA-Z/\"'^0-9\p{Sc}]+)(?:(?: in | to | as | ?> ?)(?P<targetUnit>[a-zA-Z/\"'^0-9\p{Sc}]+))?$"
Local $sString = "4/5"" & @CRLF & _
"4 m/s" & @CRLF & _
"4/3m/s" & @CRLF & _
"4/3" in ms" & @CRLF & _
"4/3km/h" & @CRLF & _
"4/3km/h in mph" & @CRLF & _
"4m in cm" & @CRLF & _
"9.0m in cm" & @CRLF & _
"9,0m in cm" & @CRLF & _
"9,0m>cm" & @CRLF & _
"9,0m>cm" & @CRLF & _
"9,0 m>cm" & @CRLF & _
"9,0 m > cm" & @CRLF & _
"9 meters as centimeters" & @CRLF & _
"1 m^3" & @CRLF & _
"4$>€" & @CRLF & _
"4€" & @CRLF & _
"4$>¥" & @CRLF & _
"" & @CRLF & _
"# Test queries from https://phabricator.kde.org/D22869" & @CRLF & _
"3/8"" & @CRLF & _
"3/8 in" & @CRLF & _
"3/8" in cm" & @CRLF & _
"3/0"" & @CRLF & _
"3"" & @CRLF & _
"3€>₱" & @CRLF & _
"" & @CRLF & _
"# Should not match" & @CRLF & _
"4 in m/s" & @CRLF & _
"4in m/s" & @CRLF & _
"4">"
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