Regular Expressions 101

Save & Share

  • Regex Version: ver. 1
  • Update Regex
    ctrl+⇧+s
  • Save new Regex
    ctrl+s
  • Add to Community Library

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java 8
  • .NET 7.0 (C#)
  • Rust
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests

Tools

Sponsors
There are currently no sponsors. Become a sponsor today!
An explanation of your regex will be automatically generated as you type.
Detailed match information will be displayed here automatically.
  • All Tokens
  • Common Tokens
  • General Tokens
  • Anchors
  • Meta Sequences
  • Quantifiers
  • Group Constructs
  • Character Classes
  • Flags/Modifiers
  • Substitution
  • A single character of: a, b or c
    [abc]
  • A character except: a, b or c
    [^abc]
  • A character in the range: a-z
    [a-z]
  • A character not in the range: a-z
    [^a-z]
  • A character in the range: a-z or A-Z
    [a-zA-Z]
  • Any single character
    .
  • Alternate - match either a or b
    a|b
  • Any whitespace character
    \s
  • Any non-whitespace character
    \S
  • Any digit
    \d
  • Any non-digit
    \D
  • Any word character
    \w
  • Any non-word character
    \W
  • Match everything enclosed
    (?:...)
  • Capture everything enclosed
    (...)
  • Zero or one of a
    a?
  • Zero or more of a
    a*
  • One or more of a
    a+
  • Exactly 3 of a
    a{3}
  • 3 or more of a
    a{3,}
  • Between 3 and 6 of a
    a{3,6}
  • Start of string
    ^
  • End of string
    $
  • A word boundary
    \b
  • Non-word boundary
    \B

Regular Expression

/
/
gm

Test String

Code Generator

Generated Code

#include <StringConstants.au3> ; to declare the Constants of StringRegExp #include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate Local $sRegex = "(?m)^(?<fullAddress>(?<mailbox>([a-zA-Z0-9\+\!\#\$\%\&\'\*\-\/\=\?\+\_\{\}\|\~]|(?<singleDot>(?<!\.)(?<!^)\.(?!\.))|(?<foldedWhiteSpace>\s?\&\#13\;\&\#10\;.)){1,64})\s?(?<singleAt>(?<!\@)(?<!\-)(?<!\.)\@(?!\@))(?<domain>(?<dns>[[:alnum:]]([[:alnum:]\-]{0,63}\.){1,24}[[:alnum:]\-]{1,63}[[:alnum:]])|(?<IPv4>\[((?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\])|(?<IPv6Full>(\[IPv6(\:[0-9a-fA-F]{1,4}){8}\]))|(?<IPv6Comp1>\[IPv6\:((([0-9a-fA-F]{1,4})\:){1,3}(\:([0-9a-fA-F]{1,4})){1,5}?\])|\[IPv6\:((([0-9a-fA-F]{1,4})\:){1,5}(\:([0-9a-fA-F]{1,4})){1,3}?\]))|(?<IPv6Comp2>(\[IPv6\:\:(\:[0-9a-fA-F]{1,4}){1,6}\]))|(?<IPv6Comp3>(\[IPv6\:([0-9a-fA-F]{1,4}\:){1,6}\:\]))|(?<IPv6Comp4>(\[IPv6\:\:\:)\])|(?<IPv6v4Full>(\[IPv6(\:[0-9a-fA-F]{1,4}){6}\:((?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3})(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\])|(?<IPv6v4Comp1>\[IPv6\:((([0-9a-fA-F]{1,4})\:){1,3}(\:([0-9a-fA-F]{1,4})){1,5}?(\:((?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))\])|\[IPv6\:((([0-9a-fA-F]{1,4})\:){1,5}(\:([0-9a-fA-F]{1,4})){1,3}?(\:((?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))\]))|(?<IPv6v4Comp2>(\[IPv6\:\:(\:[0-9a-fA-F]{1,4}){1,5}(\:((?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))\]))|(?<IPv6v4Comp3>(\[IPv6\:([0-9a-fA-F]{1,4}\:){1,5}\:(((?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))\]))|(?<IPv6v4Comp4>(\[IPv6\:\:\:((?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3})(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\])))" Local $sString = "Valid (as per futility) addresses that I agree are valid" & @CRLF & _ "========================================================" & @CRLF & _ "_somename@iana.org test62 Valid" & @CRLF & _ "_Yosemite.Sam@iana.org test128 Valid" & @CRLF & _ "!def!xyz%abc@iana.org test61 Valid" & @CRLF & _ "{_test_}@iana.org test90 Valid" & @CRLF & _ "+1~1+@iana.org test89 Valid" & @CRLF & _ "~@iana.org test129 Valid" & @CRLF & _ "$A12345@iana.org test60 Valid" & @CRLF & _ "1234567890@iana.org test85 Valid" & @CRLF & _ "1234567890123456789012345678901234567890123456789012345678@12345678901234567890123456789012345678901234567890123456789.12345678901234567890123456789012345678901234567890123456789.123456789012345678901234567890123456789012345678901234567890123.iana.org test9 Valid" & @CRLF & _ "1234567890123456789012345678901234567890123456789012345678901234@iana.org test2 Valid" & @CRLF & _ "a-b@bar.com test202 Valid" & @CRLF & _ "a@b.co-foo.uk test209 Valid" & @CRLF & _ "a@bar.com test193 Valid" & @CRLF & _ "aaa@[123.123.123.123] test197 Valid" & @CRLF & _ "cdburgess+!#$%&'*-/=?+_{}|~test@gmail.com test229 Valid" & @CRLF & _ "customer/department@iana.org test127 Valid" & @CRLF & _ "customer/department=shipping@iana.org test59 Valid" & @CRLF & _ "dclo@us.ibm.com test63 Valid" & @CRLF & _ "first.last @iana.org test223 Valid" & @CRLF & _ "first.last@[12.34.56.78] test10 Valid" & @CRLF & _ "first.last@[IPv6:::] test233 Valid" & @CRLF & _ "first.last@[IPv6:::1111:2222:3333:4444:5555:6666] test14 Valid" & @CRLF & _ "first.last@[IPv6:::12.34.56.78] test11 Valid" & @CRLF & _ "first.last@[IPv6:::a2:a3:a4:b1:ffff:11.22.33.44] test252 Valid" & @CRLF & _ "first.last@[IPv6:::a3:a4:b1:ffff:11.22.33.44] test251 Valid" & @CRLF & _ "first.last@[IPv6:1111:2222:3333::4444:5555:6666:7777] test45 Valid" & @CRLF & _ "first.last@[IPv6:::b3:b4] test239 Valid" & @CRLF & _ "first.last@[IPv6:::b4] test236 Valid" & @CRLF & _ "first.last@[IPv6:0123:4567:89ab:cdef::] test249 Valid" & @CRLF & _ "first.last@[IPv6:0123:4567:89ab:CDEF::] test250 Valid" & @CRLF & _ "first.last@[IPv6:0123:4567:89ab:cdef::11.22.33.44] test262 Valid" & @CRLF & _ "first.last@[IPv6:0123:4567:89ab:CDEF::11.22.33.44] test264 Valid" & @CRLF & _ "first.last@[IPv6:1111:2222:3333::4444:12.34.56.78] test12 Valid" & @CRLF & _ "first.last@[IPv6:1111:2222:3333::4444:5555:12.34.56.78] test38 Valid" & @CRLF & _ "first.last@[IPv6:1111:2222:3333::4444:5555:6666] test15 Valid" & @CRLF & _ "first.last@[IPv6:1111:2222:3333:4444:5555:6666::] test16 Valid" & @CRLF & _ "first.last@[IPv6:1111:2222:3333:4444:5555:6666:12.34.56.78] test13 Valid" & @CRLF & _ "first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777:8888] test17 Valid" & @CRLF & _ "first.last@[IPv6:a1::] test244 Valid" & @CRLF & _ "first.last@[IPv6:a1::11.22.33.44] test258 Valid" & @CRLF & _ "first.last@[IPv6:a1::b2:11.22.33.44] test270 Valid" & @CRLF & _ "first.last@[IPv6:a1::b4] test241 Valid" & @CRLF & _ "first.last@[IPv6:a1:a2::] test247 Valid" & @CRLF & _ "first.last@[IPv6:a1:a2::11.22.33.44] test260 Valid" & @CRLF & _ "first.last@[IPv6:a1:a2:a3:a4::11.22.33.44] test253 Valid" & @CRLF & _ "first.last@[IPv6:a1:a2:a3:a4:b1::11.22.33.44] test254 Valid" & @CRLF & _ "first.last@123.iana.org test20 Valid" & @CRLF & _ "first.last@3com.com test19 Valid" & @CRLF & _ "first.last@example.123 test48 Valid" & @CRLF & _ "first.last@iana.org test1 Valid" & @CRLF & _ "first.last@x23456789012345678901234567890123456789012345678901234567890123.iana.org test18 Valid" & @CRLF & _ "foobar@192.168.0.1 test216 Valid" & @CRLF & _ "Ima.Fool@iana.org test135 Valid" & @CRLF & _ "name.lastname@domain.com test188 Valid" & @CRLF & _ "peter.piper@iana.org test66 Valid" & @CRLF & _ "shaitan@my-domain.thisisminekthx test214 Valid" & @CRLF & _ "t*est@iana.org test88 Valid" & @CRLF & _ "test-test@iana.org test87 Valid" & @CRLF & _ "test. &#13;&#10; &#13;&#10; obs@syntax.com test224 Valid" & @CRLF & _ "Test.&#13;&#10; Folding.&#13;&#10; Whitespace@iana.org test152 Valid" & @CRLF & _ "test.test@iana.org test92 Valid" & @CRLF & _ "test@[123.123.123.123] test98 Valid" & @CRLF & _ "test@123.123.123.123 test97 Valid" & @CRLF & _ "test@123.123.123.x123 test96 Valid" & @CRLF & _ "test@example.example.iana.org test100 Valid" & @CRLF & _ "test@example.iana.org test99 Valid" & @CRLF & _ "test@iana.org test83 Valid" & @CRLF & _ "TEST@iana.org test84 Valid" & @CRLF & _ "test@test.com test277 Valid" & @CRLF & _ "test@xn--example.com test279 Valid" & @CRLF & _ "test+test@iana.org test86 Valid" & @CRLF & _ "user%uucp!path@berkeley.edu test220 Valid" & @CRLF & _ "user+mailbox@iana.org test58 Valid" & @CRLF & _ "valid@about.museum test212 Valid" & @CRLF & _ "" & @CRLF & _ "Valid (as per futility) addresses that are invalid as per RFC5321" & @CRLF & _ "============================================================================" & @CRLF & _ "+@b.c test203 Valid" & @CRLF & _ "first.last@com test49 Valid" & @CRLF & _ "a@b test190 Valid" & @CRLF & _ "a@bar test201 Valid" & @CRLF & _ "test@Bücher.ch test280 Valid" & @CRLF & _ "test@example test116 Valid" & @CRLF & _ "first.last@[IPv6:::a2:a3:a4:b1:b2:b3:b4] test230 Valid" & @CRLF & _ "first.last@[IPv6:a1:a2:a3:a4:b1:b2:b3::] test231 Valid" & @CRLF & _ "+@b.com test204 Valid" & @CRLF & _ "" & @CRLF & _ "My tests for valid IPv6 and v6v4 addresses" & @CRLF & _ "==========================================" & @CRLF & _ "first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777:8888]" & @CRLF & _ "first.last@[IPv6:1111:2222:3333:4444:5555:6666:12.34.56.78]" & @CRLF & _ "" & @CRLF & _ "first.last@[IPv6:1111:2222:3333:4444:5555:6666::]" & @CRLF & _ "first.last@[IPv6:1111:2222:3333:4444:5555::8888]" & @CRLF & _ "first.last@[IPv6:1111:2222:3333:4444::7777:8888]" & @CRLF & _ "first.last@[IPv6:1111:2222:3333::6666:7777:8888]" & @CRLF & _ "first.last@[IPv6:1111:2222::5555:6666:7777:8888]" & @CRLF & _ "first.last@[IPv6:1111::4444:5555:6666:7777:8888]" & @CRLF & _ "first.last@[IPv6:::3333:4444:5555:6666:7777:8888]" & @CRLF & _ "first.last@[IPv6:1111:2222:3333:4444:5555::]" & @CRLF & _ "first.last@[IPv6:1111:2222:3333:4444::8888]" & @CRLF & _ "first.last@[IPv6:1111:2222:3333::7777:8888]" & @CRLF & _ "first.last@[IPv6:1111:2222::6666:7777:8888]" & @CRLF & _ "first.last@[IPv6:1111::5555:6666:7777:8888]" & @CRLF & _ "first.last@[IPv6:::4444:5555:6666:7777:8888]" & @CRLF & _ "first.last@[IPv6:::3333:4444:5555:6666:7777:8888]" & @CRLF & _ "first.last@[IPv6:1111:2222:3333:4444::12.34.56.78]" & @CRLF & _ "first.last@[IPv6:1111:2222:3333::6666:12.34.56.78]" & @CRLF & _ "first.last@[IPv6:1111:2222::5555:6666:12.34.56.78]" & @CRLF & _ "first.last@[IPv6:1111::4444:5555:6666:12.34.56.78]" & @CRLF & _ "first.last@[IPv6:::3333:4444:5555:6666:12.34.56.78]" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "Invalid (as per futility) addresses with valid mailbox defective domain" & @CRLF & _ "=======================================================================" & @CRLF & _ "x@x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x2 test8 Valid" & @CRLF & _ "123456789012345678901234567890123456789012345678901234567890@12345678901234567890123456789012345678901234567890123456789.12345678901234567890123456789012345678901234567890123456789.12345678901234567890123456789012345678901234567890123456789.12345.iana.org test21 Invalid" & @CRLF & _ "first.last@[IPv6:1111:2222:33333::7777:8888] test47 Invalid" & @CRLF & _ "aaa@[123.123.123.123]a test198 Invalid" & @CRLF & _ "a@b-.com test206 Invalid" & @CRLF & _ "a@bar.com. test200 Invalid" & @CRLF & _ "a@-b.com test205 Invalid" & @CRLF & _ "aaa@.123 test196 Invalid" & @CRLF & _ "aaa@.com test195 Invalid" & @CRLF & _ "aaa@[123.123.123.333] test199 Invalid" & @CRLF & _ "abc@def@iana.org test69 Invalid" & @CRLF & _ "doug@ test73 Invalid" & @CRLF & _ "first.last@ test33 Invalid" & @CRLF & _ "first.last@-xample.com test50 Invalid" & @CRLF & _ "first.last@[::12.34.56.78] test37 Invalid" & @CRLF & _ "first.last@[.12.34.56.78] test35 Invalid" & @CRLF & _ "first.last@[12.34.56.789] test36 Invalid" & @CRLF & _ "first.last@[IPv5:::12.34.56.78] test37 Invalid" & @CRLF & _ "first.last@[IPv6::::] test234 Invalid" & @CRLF & _ "first.last@[IPv6::::11.22.33.44] test256 Invalid" & @CRLF & _ "first.last@[IPv6::::b3:b4] test240 Invalid" & @CRLF & _ "first.last@[IPv6::::b4] test237 Invalid" & @CRLF & _ "first.last@[IPv6::] test232 Invalid" & @CRLF & _ "first.last@[IPv6::11.22.33.44] test255 Invalid" & @CRLF & _ "first.last@[IPv6::a2::b4] test273 Invalid" & @CRLF & _ "first.last@[IPv6::a2:a3:a4:b1:b2:b3:b4] test275 Invalid" & @CRLF & _ "first.last@[IPv6::b3:b4] test238 Invalid" & @CRLF & _ "first.last@[IPv6::b4] test235 Invalid" & @CRLF & _ "first.last@[IPv6:0123:4567:89ab:cdef::11.22.33.xx] test263 Invalid" & @CRLF & _ "first.last@[IPv6:0123:4567:89ab:CDEFF::11.22.33.44] test265 Invalid" & @CRLF & _ "first.last@[IPv6:1111:2222::3333::4444:5555:6666] test44 Invalid" & @CRLF & _ "first.last@[IPv6:1111:2222:3333:4444:5555:12.34.56.78] test40 Invalid" & @CRLF & _ "first.last@[IPv6:1111:2222:3333:4444:5555:6666:12.34.567.89] test158 Invalid" & @CRLF & _ "first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777:12.34.56.78] test41 Invalid" & @CRLF & _ "first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777:8888:9999] test43 Invalid" & @CRLF & _ "first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777] test42 Invalid" & @CRLF & _ "first.last@[IPv6:1111:2222:333x::4444:5555] test46 Invalid" & @CRLF & _ "first.last@[IPv6:a1:::] test245 Invalid" & @CRLF & _ "first.last@[IPv6:a1:::11.22.33.44] test259 Invalid" & @CRLF & _ "first.last@[IPv6:a1:::b4] test242 Invalid" & @CRLF & _ "first.last@[IPv6:a1::11.22.33.44.55] test268 Invalid" & @CRLF & _ "first.last@[IPv6:a1::11.22.33] test267 Invalid" & @CRLF & _ "first.last@[IPv6:a1::a4:b1::b4:11.22.33.44] test266 Invalid" & @CRLF & _ "first.last@[IPv6:a1::b2::11.22.33.44] test271 Invalid" & @CRLF & _ "first.last@[IPv6:a1::b211.22.33.44] test269 Invalid" & @CRLF & _ "first.last@[IPv6:a1::b3:] test272 Invalid" & @CRLF & _ "first.last@[IPv6:a1:] test243 Invalid" & @CRLF & _ "first.last@[IPv6:a1:11.22.33.44] test257 Invalid" & @CRLF & _ "first.last@[IPv6:a1:a2:::] test248 Invalid" & @CRLF & _ "first.last@[IPv6:a1:a2:::11.22.33.44] test261 Invalid" & @CRLF & _ "first.last@[IPv6:a1:a2:] test246 Invalid" & @CRLF & _ "first.last@[IPv6:a1:a2:a3:a4::b1:b2:b3:b4] test276 Invalid" & @CRLF & _ "first.last@[IPv6:a1:a2:a3:a4:b1:b2:b3:] test274 Invalid" & @CRLF & _ "first.last@exampl-.com test51 Invalid" & @CRLF & _ "first.last@sub.do,com test3 Invalid" & @CRLF & _ "first.last@x234567890123456789012345678901234567890123456789012345678901234.iana.org test52 Invalid" & @CRLF & _ "foo@[\1.2.3.4] test149 Invalid" & @CRLF & _ "gatsby@f.sc.ot.t.f.i.tzg.era.l.d. test82 Invalid" & @CRLF & _ "Invalid@about.museum- test213 Invalid" & @CRLF & _ "test@[123.123.123.123 test117 Invalid" & @CRLF & _ "test@@iana.org test106 Invalid" & @CRLF & _ "test@123.123.123.123] test118 Invalid" & @CRLF & _ "test@123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012.com test115 Invalid" & @CRLF & _ "test@example. test113 Invalid" & @CRLF & _ "test@example.com&#10; test278 Invalid" & @CRLF & _ "x@x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456 test34 Invalid" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "Invalid (as per futility) addresses with valid domain defective mailbox" & @CRLF & _ "=======================================================================" & @CRLF & _ "-- test --@iana.org test107 Invalid" & @CRLF & _ ".@iana.org test133 Invalid" & @CRLF & _ ".dot@iana.org test76 Invalid" & @CRLF & _ ".first.last@iana.org test24 Invalid" & @CRLF & _ ".test@iana.org test104 Invalid" & @CRLF & _ ".wooly@iana.org test130 Invalid" & @CRLF & _ "()[]\;:,><@iana.org test111 Invalid" & @CRLF & _ "[test]@iana.org test108 Invalid" & @CRLF & _ "{^c\@**Dog^}@cartoon.com test161 Invalid" & @CRLF & _ "@iana.org test72 Invalid" & @CRLF & _ "12345678901234567890123456789012345678901234567890123456789012345@iana.org test23 Invalid" & @CRLF & _ "Abc\@def@iana.org test155 Invalid" & @CRLF & _ "abc\@def@iana.org test64 Invalid" & @CRLF & _ "abc\@iana.org test71 Invalid" & @CRLF & _ "abc\\@def@iana.org test70 Invalid" & @CRLF & _ "abc\\@iana.org test65 Invalid" & @CRLF & _ "dot.@iana.org test77 Invalid" & @CRLF & _ "first..last@iana.org test26 Invalid" & @CRLF & _ "first.last.@iana.org test25 Invalid" & @CRLF & _ "first(12345678901234567890123456789012345678901234567890)last@(1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890)iana.org test173 Invalid" & @CRLF & _ "first(abc(\"def\".ghi).mno)middle(abc(\"def\".ghi).mno).last@(abc(\"def\".ghi).mno)example(abc(\"def\".ghi).mno).(abc(\"def\".ghi).mno)com(abc(\"def\".ghi).mno) test183 Invalid" & @CRLF & _ "first(middle)last@iana.org test179 Invalid" & @CRLF & _ "first\@last@iana.org test5 Invalid" & @CRLF & _ "first\\@last@iana.org test32 Invalid" & @CRLF & _ "first\last@iana.org test154 Invalid" & @CRLF & _ "Fred\ Bloggs@iana.org test156 Invalid" & @CRLF & _ "hello world@iana.org test81 Invalid" & @CRLF & _ "Ima Fool@iana.org test138 Invalid" & @CRLF & _ "Invalid \&#10; Folding \&#10; Whitespace@iana.org test218 Invalid" & @CRLF & _ "Joe.\\Blow@iana.org test157 Invalid" & @CRLF & _ "NotAnEmail test119 Invalid" & @CRLF & _ "ote\"@iana.org test75 Invalid" & @CRLF & _ "phil.h\@\@ck@haacked.com test139 Invalid" & @CRLF & _ "pootietang.@iana.org test132 Invalid" & @CRLF & _ "test..test@iana.org test103 Invalid" & @CRLF & _ "test.@iana.org test102 Invalid" & @CRLF & _ "test.&#13;&#10;&#13;&#10; obs@syntax.com test225 Invalid" & @CRLF & _ "test.iana.org test101 Invalid" & @CRLF & _ "test@. test112 Invalid" & @CRLF & _ "test@...........com test215 Invalid" & @CRLF & _ "test@.org test114 Invalid" & @CRLF & _ "test@test@iana.org test105 Invalid" & @CRLF & _ "two..dot@iana.org test78 Invalid" & @CRLF & _ "Unicode NULL \\\u0000@char.com test228 Invalid" & @CRLF & _ "wo..oly@iana.org test131 Invalid" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "Invalid (as per futility) addresses with defective mailbox and domain" & @CRLF & _ "=======================================================================" & @CRLF & _ "-- test --@iana.org test107 Invalid" & @CRLF & _ "-@..com test207 Invalid" & @CRLF & _ "-@a..com test208 Invalid" & @CRLF & _ ".@ test189 Invalid" & @CRLF & _ "@@bar.com test192 Invalid" & @CRLF & _ "@bar.com test191 Invalid" & @CRLF & _ "@NotAnEmail test120 Invalid" & @CRLF & _ "aaa.com test194 Invalid" & @CRLF & _ "first.last test22 Invalid" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "Valid (as per futility) addresses that use parenthesis or quotes" & @CRLF & _ "================================================================" & @CRLF & _ "&#13;&#10; (&#13;&#10; x &#13;&#10; ) &#13;&#10; first&#13;&#10; ( &#13;&#10; x&#13;&#10; ) &#13;&#10; .&#13;&#10; ( &#13;&#10; x) &#13;&#10; last &#13;&#10; ( x &#13;&#10; ) &#13;&#10; @iana.org test222 Valid" & @CRLF & _ "1234 @ local(blah) .machine .example test178 Valid" & @CRLF & _ "a(a(b(c)d(e(f))g)h(i)j)@iana.org test186 Valid" & @CRLF & _ "c@(Chris's host.)public.example test176 Valid" & @CRLF & _ "cal(foo\)bar)@iamcal.com test167 Valid" & @CRLF & _ "cal(foo\@bar)@iamcal.com test166 Valid" & @CRLF & _ "cal(woo(yay)hoopla)@iamcal.com test165 Valid" & @CRLF & _ "cal@iamcal(woo).(yay)com test163 Valid" & @CRLF & _ "first.last@x(1234567890123456789012345678901234567890123456789012345678901234567890).com test185 Valid" & @CRLF & _ "HM2Kinsists@(that comments are allowed)this.is.ok test219 Valid" & @CRLF & _ "jdoe@machine(comment). example test177 Valid" & @CRLF & _ "first.(\")middle.last(\")@iana.org test182 Valid" & @CRLF & _ "first.(&#13;&#10; middle&#13;&#10; )last@iana.org test172 Valid" & @CRLF & _ "first.\"last\"@iana.org test144 Valid" & @CRLF & _ "first.\"mid\\dle\".\"last\"@iana.org test151 Valid" & @CRLF & _ "first(Welcome to&#13;&#10; the (\"wonderful\" (!)) world&#13;&#10; of email)@iana.org test174 Valid" & @CRLF & _ "pete(his account)@silly.test(his host) test175 Valid" & @CRLF & _ "first().last@iana.org test171 Valid" & @CRLF & _ "first(a\"bc.def).last@iana.org test181 Valid" & @CRLF & _ "first(abc.def).last@iana.org test180 Valid" & @CRLF & _ "first(abc\(def)@iana.org test184 Valid" & @CRLF & _ "first().last@iana.org test171 Valid" & @CRLF & _ "first(a\"bc.def).last@iana.org test181 Valid" & @CRLF & _ "first(abc.def).last@iana.org test180 Valid" & @CRLF & _ "first(abc\(def)@iana.org test184 Valid" & @CRLF & _ "(foo)cal(bar)@(baz)iamcal.com(quux) test162 Valid" & @CRLF & _ "test.\"test\"@iana.org test94 Valid" & @CRLF & _ ""\"Unicode NULL \\\u0000\"@char.com test226 Valid" & @CRLF & _ "\"[[ test ]]\"@iana.org test91 Valid" & @CRLF & _ "\"Abc@def\"@iana.org test56 Valid" & @CRLF & _ "\"Abc\\@def\"@iana.org test53 Valid" & @CRLF & _ "\"Austin@Powers\"@iana.org test134 Valid" & @CRLF & _ "\"Doug \\\"Ace\\\" L.\"@iana.org test68 Valid" & @CRLF & _ "\"first..last\"@iana.org test148 Valid" & @CRLF & _ "\"first.middle.last\"@iana.org test147 Valid" & @CRLF & _ "\"first.middle\".\"last\"@iana.org test146 Valid" & @CRLF & _ "\"first(last)\"@iana.org test221 Valid" & @CRLF & _ "\"first@last\"@iana.org test6 Valid" & @CRLF & _ "\"first\".\"last\"@iana.org test140 Valid" & @CRLF & _ "\"first\".\"middle\".\"last\"@iana.org test145 Valid" & @CRLF & _ "\"first\".last@iana.org test143 Valid" & @CRLF & _ "\"first\".middle.\"last\"@iana.org test141 Valid" & @CRLF & _ "\"first\\\"last\"@iana.org test4 Valid" & @CRLF & _ "\"first\\\\\\\"last\"@iana.org test150 Valid" & @CRLF & _ "\"first\\\\last\"@iana.org test7 Valid" & @CRLF & _ "\"first\\last\"@iana.org test28 Valid" & @CRLF & _ "\"Fred Bloggs\"@iana.org test57 Valid" & @CRLF & _ "\"Fred\\ Bloggs\"@iana.org test54 Valid" & @CRLF & _ "\"hello my name is\"@stutter.com test210 Valid" & @CRLF & _ "\"Ima Fool\"@iana.org test137 Valid" & @CRLF & _ "\"Ima.Fool\"@iana.org test136 Valid" & @CRLF & _ "\"Joe.\\\\Blow\"@iana.org test55 Valid" & @CRLF & _ "\"Joe\\\\Blow\"@iana.org test217 Valid" & @CRLF & _ "\"Test \\\"Fail\\\" Ing\"@iana.org test211 Valid" & @CRLF & _ "\"test.test\"@iana.org test93 Valid" & @CRLF & _ "\"test@test\"@iana.org test95 Valid" & @CRLF & _ "\"test\\\"blah\"@iana.org test125 Valid" & @CRLF & _ "\"test\\\\blah\"@iana.org test121 Valid" & @CRLF & _ "\"test\\&#13;blah\"@iana.org test123 Valid" & @CRLF & _ "\"test\\blah\"@iana.org test122 Valid" & @CRLF & _ "\"test\\test\"@iana.org test109 Valid" & @CRLF & _ "\"test&#13;&#10; blah\"@iana.org test160 Valid" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "Invalid (as per futility) addresses that use parenthesis or quotes" & @CRLF & _ "==================================================================" & @CRLF & _ "\"\"@iana.org test31 Invalid" & @CRLF & _ "\"\"\"@iana.org test29 Invalid" & @CRLF & _ "\"\\\"@iana.org test30 Invalid" & @CRLF & _ "\"Doug \"Ace\" L.\"@iana.org test79 Invalid" & @CRLF & _ "\"first\"last\"@iana.org test27 Invalid" & @CRLF & _ "\"first\\\\\"last\"@iana.org test142 Invalid" & @CRLF & _ "\"foo\"(yay)@(hoopla)[1.2.3.4] test164 Invalid" & @CRLF & _ "\"qu@iana.org test74 Invalid" & @CRLF & _ "\"test\"blah\"@iana.org test126 Invalid" & @CRLF & _ "\"test\"test\"@iana.org test110 Invalid" & @CRLF & _ "\"test\&#13;&#10; blah\"@iana.org test159 Invalid" & @CRLF & _ "\"test&#13;blah\"@iana.org test124 Invalid" & @CRLF & _ "\"Unicode NULL \u0000\"@char.com test227 Invalid" & @CRLF & _ "a(a(b(c)d(e(f))g)(h(i)j)@iana.org test187 Invalid" & @CRLF & _ "cal(foo(bar)@iamcal.com test168 Invalid" & @CRLF & _ "cal(foo)bar)@iamcal.com test196 Invalid" & @CRLF & _ "cal(foo\)@iamcal.com test170 Invalid" & @CRLF & _ "Doug\\ \\\"Ace\\\"\\ L\\.@iana.org test80 Invalid" & @CRLF & _ "Doug\\ \\\"Ace\\\"\\ Lovell@iana.org test67 Invalid" & @CRLF & _ "first.\"\".last@iana.org test153 Invalid" 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