#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)\bcolou?r(?:[a-zA-Z’s]+)?\b"
Local $sString = "Red is a color." & @CRLF & _
"His collar is too tight or too colouuuurful." & @CRLF & _
"These are bright colours." & @CRLF & _
"These are bright colors." & @CRLF & _
"Calorific is a scientific term." & @CRLF & _
"“Your life is very colorful,” she said." & @CRLF & _
"color (U.S. English, singular noun)" & @CRLF & _
"colour (British English, singular noun)" & @CRLF & _
"colors (U.S. English, plural noun)" & @CRLF & _
"colours (British English, plural noun)" & @CRLF & _
"color’s (U.S. English, possessive singular)" & @CRLF & _
"colour’s (British English, possessive singular)" & @CRLF & _
"colors’ (U.S. English, possessive plural)" & @CRLF & _
"colours’ (British English, possessive plural)"
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