#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?mix)([0-9]+)(?:-([0-9]+)|\s*over)"
Local $sString = "'m trying to match speed descriptions of highway tickets, for example,text lines:" & @CRLF & _
"" & @CRLF & _
""L A 16-25MPH" should return 2 groups: 16, 25 " & @CRLF & _
""LIMITED ACCESS SPEED I-75" should return no matches." & @CRLF & _
""LMT ACC 6-10" should return 2 groups: 6, 10 " & @CRLF & _
""6 OVER" should return 1 group: 6" & @CRLF & _
"" & @CRLF & _
"I'm OK with all of the above situations, but I run into issues for strings with numbers that aren't related to speed, for example:" & @CRLF & _
"" & @CRLF & _
""
Local $sSubst = ""
Local $sResult = StringRegExpReplace($sString, $sRegex, $sSubst)
MsgBox($MB_SYSTEMMODAL, "Result", $sResult)
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