#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)^-{2}\b[a-z][a-z\d]{2,}\b(-{1}[a-z\d]+)*$"
Local $sString = "--valid" & @CRLF & _
"--th1s-is-also-val1d" & @CRLF & _
"--match-this-option-as-well" & @CRLF & _
"" & @CRLF & _
"--9this-is-invalid-because-of-the-leading-digit" & @CRLF & _
"--this--is--invalid--because--of--word--wrapping--by--multiple--hyphens" & @CRLF & _
"--this-should-also-fail-because-of-the-trailing-hyphen-" & @CRLF & _
"" & @CRLF & _
"-A -g -1 -Ag1 --valid --th1s-is-also-val1d --match-this-option-as-well --9this-is-invalid-because-of-the-leading-digit --this--is--invalid--because--of--word--wrapping--by--multiple--hyphens --this-should-also-fail-because-of-the-trailing-hyphen- --load-file="ReAdMe2.TxT""
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