#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^(?=.{3,16}$)[a-z]([0-9a-z]|[0-9a-z\-](?=[0-9a-z])){1,}([\.](?=[a-z][0-9a-z\-][0-9a-z\-])[a-z]([0-9a-z]|[0-9a-z\-](?=[0-9a-z])){1,}){0,}$"
Local $sString = "cryptosharon" & @CRLF & _
"cry.pto" & @CRLF & _
"-----" & @CRLF & _
"cr" & @CRLF & _
"sh.ar" & @CRLF & _
"-----" & @CRLF & _
"cryptosharon9" & @CRLF & _
"cry.pto9" & @CRLF & _
"c-r.y-p.t-o9" & @CRLF & _
"-----" & @CRLF & _
"9cryptosharon" & @CRLF & _
"9sh.aron" & @CRLF & _
"sha.9ron" & @CRLF & _
"-----" & @CRLF & _
"cry-9-pto-5" & @CRLF & _
"s-h-a-r-o-n9" & @CRLF & _
"a12.b-3" & @CRLF & _
"-----" & @CRLF & _
"sh--aron" & @CRLF & _
"crptshrn-" & @CRLF & _
"otp-.yrc" & @CRLF & _
"-----" & @CRLF & _
"a12345678901234567" & @CRLF & _
"-test-123" & @CRLF & _
".test.123" & @CRLF & _
"123.test" & @CRLF & _
"tes"
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