#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^[a-z]+(?:_[a-z]+)*$"
Local $sString = "welcome_to_snake_case" & @CRLF & _
"" & @CRLF & _
"PASS :" & @CRLF & _
"snake_case" & @CRLF & _
"cellule" & @CRLF & _
"sous_cellule" & @CRLF & _
"a" & @CRLF & _
"a_a" & @CRLF & _
"all_good" & @CRLF & _
"" & @CRLF & _
"FAIL :" & @CRLF & _
"/^[a-z]+(\_[a-z]+)*$/gm" & @CRLF & _
"camelCase" & @CRLF & _
"PascalCase" & @CRLF & _
"kebab-case" & @CRLF & _
"UPPERCASE" & @CRLF & _
"big_sNAKe_case" & @CRLF & _
"snake_digita1ised_case" & @CRLF & _
"one_is_there^" & @CRLF & _
"_" & @CRLF & _
"___" & @CRLF & _
"no_trailing_dash_" & @CRLF & _
"_actually_neither_way" & @CRLF & _
"_norboth_" & @CRLF & _
"no_space " & @CRLF & _
"no_other_special-char" & @CRLF & _
"all_good?yes"
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