#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?im)^([A-Za-z0-9]\s?)+\s-\s(Before|After)\s((Insert|Update|Delete)|(Insert\/Update))\s-\s([A-Za-z0-9]\s?)+$"
Local $sString = "Valid Cases matching standards:" & @CRLF & _
"" & @CRLF & _
"Opportunity - Before Insert/Update - Update Amount Before We Die" & @CRLF & _
"Case - After Update - Send Notification" & @CRLF & _
"Lead - Before Delete - Archive Record" & @CRLF & _
"Opportunity Line Item - After Insert - 123 sdsad asdasd" & @CRLF & _
"Quote Line Asset - Before Insert - Hello World " & @CRLF & _
"Account - After Update - Yes Man This Can Be Anything" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"Invalid cases:" & @CRLF & _
"account - Before Save - Update Name (Object should start with an uppercase letter)" & @CRLF & _
"Account - before save - Update Name (Context should start with an uppercase letter)" & @CRLF & _
"Account - Before Save - update name (Action should start with an uppercase letter)" & @CRLF & _
"Account-Before Save-Update Name (Missing spaces around hyphens)" & @CRLF & _
"Account - Before/After Save - Update Name (Invalid characters in Context)" & @CRLF & _
"Custom_Object__c - After Undelete - Restore Record" & @CRLF & _
"Opportunity_Line_Item - Before Insert - Validate Quantity"
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