#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?i)(?P<amount>-?\d+(?:\.\d*)?)[^\S\n]*(?P<degrees>°|deg(?:rees?)?|in)?[^\S\n]*(?P<unit>c(?:(?=el[cs]ius\b|entigrades?\b|\b))|f(?:(?=ahrenheit\b|\b))|k(?:(?=elvins?\b|\b)))"
Local $sString = "70 degrees celsius" & @CRLF & _
"70 degree fahrenheit" & @CRLF & _
"70 degrees c" & @CRLF & _
"70 degrees f" & @CRLF & _
"70 ° f" & @CRLF & _
"70 ° c" & @CRLF & _
"70°c" & @CRLF & _
"70°f" & @CRLF & _
"70 deg celsius" & @CRLF & _
"70 deg centigrade" & @CRLF & _
"70 deg fahrenheit" & @CRLF & _
"-30.5 in Kelvin" & @CRLF & _
"-30.5 degrees Kelvin" & @CRLF & _
"-30.5 Kelvin" & @CRLF & _
"70F" & @CRLF & _
"70C" & @CRLF & _
"70 c" & @CRLF & _
"70 f" & @CRLF & _
"70k" & @CRLF & _
"100 deg celcius" & @CRLF & _
"" & @CRLF & _
"Oh, it seems I have an oven from Europe. If the recipe calls for 325 degrees fahrenheit and water boils at 100 centigrades, then... multiply, and... voila! Set your oven for 650 degrees celsius--that should make your cookies crispy-brown!" & @CRLF & _
"" & @CRLF & _
"# Failures" & @CRLF & _
"" & @CRLF & _
"70 degrees # too ambiguous" & @CRLF & _
"70 deg felsius # ensure we don't mix fahrenheit and celsius" & @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