#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^(The|A|An)"
Local $sString = "A Great Calamity." & @CRLF & _
"An Original idea and Time of the Day." & @CRLF & _
"Alice in Wonderland and a and the Tools" & @CRLF & _
"The Runner and a Scam" & @CRLF & _
"The Boy and the Car and a Box" & @CRLF & _
"They Had a Dream" & @CRLF & _
"the dream is here" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"Try clicking the "Run Match" button (or F5) to see what" & @CRLF & _
"happens. After a successful match click in the results box" & @CRLF & _
"to highlight the matched text. Click the "Replace" button" & @CRLF & _
"using the "Dates" example. Notice in the results box that the" & @CRLF & _
"format of all the dates has been altered. Using the" & @CRLF & _
""Expression Library" tab double-click another regular" & @CRLF & _
"expression and "Run Match"." & @CRLF & _
"" & @CRLF & _
"Click "Show the Builder" (or Ctrl+D) to start designing your" & @CRLF & _
"own regular expressions; or enter them directly in the" & @CRLF & _
"regular expression box. Enter the text you want to search in" & @CRLF & _
"the sample text box." & @CRLF & _
"" & @CRLF & _
"Expand nodes in the "Regex Analyzer" to see a description" & @CRLF & _
"of the current regular expression. Right-click a node to edit" & @CRLF & _
"the expression." & @CRLF & _
"" & @CRLF & _
"--- Sample text ---" & @CRLF & _
"Comma Separated Values" & @CRLF & _
"a,b,c,d,e" & @CRLF & _
"Dog,Cat,Puppy" & @CRLF & _
"" & @CRLF & _
"US phone numbers, (800) 325-3535, (650) 555 1212" & @CRLF & _
"US zip codes, 95076-1234, 90210-6473" & @CRLF & _
"Dates:12/25/02 9/11/2001 11/22/63 12/7/41" & @CRLF & _
"" & @CRLF & _
"URLs:" & @CRLF & _
"http://www.usgs.gov" & @CRLF & _
"http://www.acl.lanl.gov/URI/archive/uri-archive.index.html" & @CRLF & _
"ftp://@host.com/" & @CRLF & _
"ftp://host.com/" & @CRLF & _
"ftp://foo:@host.com/" & @CRLF & _
"ftp://myname@host.dom/%2Fetc/motd" & @CRLF & _
"file://vms.host.edu/disk$user/my/notes/note12345.txt" & @CRLF & _
"prospero://host.dom//pros/name" & @CRLF & _
"" & @CRLF & _
"IP addresses:" & @CRLF & _
"123.54.63.0" & @CRLF & _
"255.257.0.1 -> This one has an illegal number" & @CRLF & _
"0.255.255.12" & @CRLF & _
"" & @CRLF & _
"UK Postal Codes:" & @CRLF & _
"M1 1AA " & @CRLF & _
"M60 1NW " & @CRLF & _
"ABD3 7BB -> This is an illegal format" & @CRLF & _
"M1 1CA -> This has illegal letters (CIKMOV) in the second half" & @CRLF & _
"W1A 1HQ " & @CRLF & _
"" & @CRLF & _
"Canadian Postal Codes:" & @CRLF & _
"A1A 1A1" & @CRLF & _
"B6C 8X7" & @CRLF & _
"5 Shoreham Drive, Downsview, Ontario, M3N 1S4" & @CRLF & _
"" & @CRLF & _
"Netherlands Postal Codes:" & @CRLF & _
"1234 ZA" & @CRLF & _
"5678 KL" & @CRLF & _
"0123 AZ -> Illegal number, must be 1000-9999" & @CRLF & _
"5432 ABQ -> Too many characters" & @CRLF & _
"" & @CRLF & _
" " & @CRLF & _
"Here is some text as bait for the multiple captures example:" & @CRLF & _
"XYZAbcAbcAbcXYZAbcAb" & @CRLF & _
"acacacac" & @CRLF & _
"" & @CRLF & _
" Paris" & @CRLF & _
" in the" & @CRLF & _
"the spring" & @CRLF & _
"" & @CRLF & _
"{a[b(c)d]e}" & @CRLF & _
"" & @CRLF & _
"Email:" & @CRLF & _
"esupport@ultrapico.com" & @CRLF & _
"maynard@krebs.com" & @CRLF & _
"" & @CRLF & _
"Hyperlinks" & @CRLF & _
"<a href="http://www.codeproject.com">The Code Project</a>" & @CRLF & _
"Href="http://ultrapico.com/Expresso.htm"" & @CRLF & _
"" & @CRLF & _
"Key-Value Pairs" & @CRLF & _
"FurryAnimal=Dog" & @CRLF & _
"NonFurryAnimal=Turtle" & @CRLF & _
"" & @CRLF & _
"HTML Tags" & @CRLF & _
"<p>Hello World</p>" & @CRLF & _
"<H1>Regular Expressions</H1>" & @CRLF & _
"" & @CRLF & _
"Social Security Numbers" & @CRLF & _
"123-45-6789" & @CRLF & _
"987-65-4321" & @CRLF & _
"" & @CRLF & _
"Mastercard" & @CRLF & _
"5134567890123456" & @CRLF & _
"Visa" & @CRLF & _
"4234567890123" & @CRLF & _
"Amex" & @CRLF & _
"343456789012345" & @CRLF & _
"Diners Club" & @CRLF & _
"30045678901234" & @CRLF & _
"Discover" & @CRLF & _
"6011567890123456" & @CRLF & _
"" & @CRLF & _
"Numbers" & @CRLF & _
"123.56" & @CRLF & _
"-234.5" & @CRLF & _
"12" & @CRLF & _
"+13" & @CRLF & _
"0.56" & @CRLF & _
"-.2" & @CRLF & _
".3" & @CRLF & _
"25." & @CRLF & _
"1.38E-23" & @CRLF & _
"0.2E45" & @CRLF & _
"6E+19" & @CRLF & _
"0AFD" & @CRLF & _
"1CA0234F"
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