Snippets

Joran Rood RFC 5322 and RFC 6532 Compliant Email Address Regular Expressions

Updated by Joran Rood

File email-regular-expressions.md Modified

  • Ignore whitespace
  • Hide word diff
-# Full RFC 5322 and RFC 6531
+# Full RFC 5322 and RFC 6532
 
-    /\A(?(DEFINE)(?<fws>(?>(?>\x0d\x0a)?[\x09\x20]+)+)(?<cfws>(?>(?&fws)?\x28(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]+|\x5c[\x00-\x7f]|(?&cfws)))*(?&fws)?\x29)+(?&fws)?|(?&fws))(?<quot>(?&cfws)?\x22(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]+|\x5c[\x00-\x7f]))*(?&fws)?\x22(?&cfws)?)(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<dot>(?&cfws)?(?&atext)(?>\x2e(?&atext))*(?&cfws)?))((?&dot)|(?&quot)|(?>(?&cfws)?(?&atext)(?&cfws)?|(?&quot))(?>\x2e(?>(?&cfws)?(?&atext)(?&cfws)?|(?&quot)))*)\x40((?&dot)|(?&cfws)?\x5b(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x5e-\x7f]+|\x5c[\x00-\x7f]))*(?&fws)?\x5d(?&cfws)?|(?&cfws)?(?&atext)(?&cfws)?(?>\x2e(?&cfws)?(?&atext)(?&cfws)?)*)\z/Su
+    /\A(?(DEFINE)(?<fws>(?>(?>\x0d\x0a)?[\x09\x20]+)+)(?<cfws>(?>(?&fws)?\x28(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x{10ffff}]+|\x5c[\x00-\x{10ffff}]|(?&cfws)))*(?&fws)?\x29)+(?&fws)?|(?&fws))(?<quot>(?&cfws)?\x22(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x{10ffff}]+|\x5c[\x00-\x{10ffff}]))*(?&fws)?\x22(?&cfws)?)(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x80-\x{10ffff}]++)(?<dot>(?&cfws)?(?&atext)(?>\x2e(?&atext))*(?&cfws)?))((?&dot)|(?&quot)|(?>(?&cfws)?(?&atext)(?&cfws)?|(?&quot))(?>\x2e(?>(?&cfws)?(?&atext)(?&cfws)?|(?&quot)))*)\x40((?&dot)|(?&cfws)?\x5b(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x5e-\x{10ffff}]+|\x5c[\x00-\x{10ffff}]))*(?&fws)?\x5d(?&cfws)?|(?&cfws)?(?&atext)(?&cfws)?(?>\x2e(?&cfws)?(?&atext)(?&cfws)?)*)\z/Su
     
-# RFC 5322 and RFC 6531 Without Comments
+# RFC 5322 and RFC 6532 Without Comments
 
-    /\A(?(DEFINE)(?<fws>(?>(?>\x0d\x0a)?[\x09\x20]+)+)(?<quot>(?&fws)?\x22(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]+|\x5c[\x00-\x7f]))*(?&fws)?\x22(?&fws)?)(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<dot>(?&fws)?(?&atext)(?>\x2e(?&atext))*(?&fws)?))((?&dot)|(?&quot)|(?>(?&fws)?(?&atext)(?&fws)?|(?&quot))(?>\x2e(?>(?&fws)?(?&atext)(?&fws)?|(?&quot)))*)\x40((?&dot)|(?&fws)?\x5b(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x5e-\x7f]+|\x5c[\x00-\x7f]))*(?&fws)?\x5d(?&fws)?|(?&fws)?(?&atext)(?&fws)?(?>\x2e(?&fws)?(?&atext)(?&fws)?)*)\z/Su
+    /\A(?(DEFINE)(?<fws>(?>(?>\x0d\x0a)?[\x09\x20]+)+)(?<quot>(?&fws)?\x22(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x{10ffff}]+|\x5c[\x00-\x{10ffff}]))*(?&fws)?\x22(?&fws)?)(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x80-\x{10ffff}]++)(?<dot>(?&fws)?(?&atext)(?>\x2e(?&atext))*(?&fws)?))((?&dot)|(?&quot)|(?>(?&fws)?(?&atext)(?&fws)?|(?&quot))(?>\x2e(?>(?&fws)?(?&atext)(?&fws)?|(?&quot)))*)\x40((?&dot)|(?&fws)?\x5b(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x5e-\x{10ffff}]+|\x5c[\x00-\x{10ffff}]))*(?&fws)?\x5d(?&fws)?|(?&fws)?(?&atext)(?&fws)?(?>\x2e(?&fws)?(?&atext)(?&fws)?)*)\z/Su
     
-# RFC 5322 and RFC 6531 Without Obsolete Syntax
+# RFC 5322 and RFC 6532 Without Obsolete Syntax
 
-    /\A(?(DEFINE)(?<fws>(?>[\x09\x20]*\x0d\x0a)?[\x09\x20]+)(?<cfws>(?>(?&fws)?\x28(?>(?&fws)?(?>[\x21-\x27\x2a-\x5b\x5d-\x7e]+|\x5c[\x09\x20-\x7e]|(?&cfws)))*(?&fws)?\x29)+(?&fws)?|(?&fws))(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<dot>(?&cfws)?(?&atext)(?>\x2e(?&atext))*(?&cfws)?))((?&dot)|(?&cfws)?\x22(?>(?&fws)?(?>[\x21\x23-\x5b\x5d-\x7e]+|\x5c[\x09\x20-\x7e]))*(?&fws)?\x22(?&cfws)?)\x40((?&dot)|(?&cfws)?\x5b(?>(?&fws)?[\x21-\x5a\x5e-\x7e]+)*(?&fws)?\x5d(?&cfws)?)\z/Su
+    /\A(?(DEFINE)(?<fws>(?>[\x09\x20]*\x0d\x0a)?[\x09\x20]+)(?<cfws>(?>(?&fws)?\x28(?>(?&fws)?(?>[\x21-\x27\x2a-\x5b\x5d-\x7e\x80-\x{10ffff}]+|\x5c[\x09\x20-\x7e\x80-\x{10ffff}]|(?&cfws)))*(?&fws)?\x29)+(?&fws)?|(?&fws))(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x80-\x{10ffff}]++)(?<dot>(?&cfws)?(?&atext)(?>\x2e(?&atext))*(?&cfws)?))((?&dot)|(?&cfws)?\x22(?>(?&fws)?(?>[\x21\x23-\x5b\x5d-\x7e\x80-\x{10ffff}]+|\x5c[\x09\x20-\x7e\x80-\x{10ffff}]))*(?&fws)?\x22(?&cfws)?)\x40((?&dot)|(?&cfws)?\x5b(?>(?&fws)?[\x21-\x5a\x5e-\x7e\x80-\x{10ffff}]+)*(?&fws)?\x5d(?&cfws)?)\z/Su
     
-# RFC 5322 and RFC 6531 Without Comments and Without Obsolete Syntax
+# RFC 5322 and RFC 6532 Without Comments and Without Obsolete Syntax
 
-    /\A(?(DEFINE)(?<fws>(?>[\x09\x20]*\x0d\x0a)?[\x09\x20]+)(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<dot>(?&fws)?(?&atext)(?>\x2e(?&atext))*(?&fws)?))((?&dot)|(?&fws)?\x22(?>(?&fws)?(?>[\x21\x23-\x5b\x5d-\x7e]+|\x5c[\x09\x20-\x7e]))*(?&fws)?\x22(?&fws)?)\x40((?&dot)|(?&fws)?\x5b(?>(?&fws)?[\x21-\x5a\x5e-\x7e]+)*(?&fws)?\x5d(?&fws)?)\z/Su
+    /\A(?(DEFINE)(?<fws>(?>[\x09\x20]*\x0d\x0a)?[\x09\x20]+)(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x80-\x{10ffff}]++)(?<dot>(?&fws)?(?&atext)(?>\x2e(?&atext))*(?&fws)?))((?&dot)|(?&fws)?\x22(?>(?&fws)?(?>[\x21\x23-\x5b\x5d-\x7e\x80-\x{10ffff}]+|\x5c[\x09\x20-\x7e\x80-\x{10ffff}]))*(?&fws)?\x22(?&fws)?)\x40((?&dot)|(?&fws)?\x5b(?>(?&fws)?[\x21-\x5a\x5e-\x7e\x80-\x{10ffff}]+)*(?&fws)?\x5d(?&fws)?)\z/Su
Updated by Joran Rood

File email-regular-expressions.md Modified

  • Ignore whitespace
  • Hide word diff
 # Full RFC 5322 and RFC 6531
 
-    /^(?(DEFINE)(?<fws>(?>[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?>(?>\x0d\x0a)?[\x09\x20]+)+)(?<cfws>(?>(?&fws)?(\x28(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]+|\x5c[\x00-\x7f]|(?&cfws)))*(?&fws)?\x29))+(?&fws)?|(?&fws))(?<quot>(?&cfws)?\x22(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]+|\x5c[\x00-\x7f]))*(?&fws)?\x22(?&cfws)?)(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<dot>(?&cfws)?(?&atext)(?>\x2e(?&atext))*(?&cfws)?))((?&dot)|(?&quot)|(?>(?&cfws)?(?&atext)(?&cfws)?|(?&quot))(?>\x2e(?>(?&cfws)?(?&atext)(?&cfws)?|(?&quot)))*)\x40((?&dot)|(?&cfws)?\x5b(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x5e-\x7f]+|\x5c[\x00-\x7f]))*(?&fws)?\x5d(?&cfws)?|(?&cfws)?(?&atext)(?&cfws)?(?>\x2e(?&cfws)?(?&atext)(?&cfws)?)*)$/muS
+    /\A(?(DEFINE)(?<fws>(?>(?>\x0d\x0a)?[\x09\x20]+)+)(?<cfws>(?>(?&fws)?\x28(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]+|\x5c[\x00-\x7f]|(?&cfws)))*(?&fws)?\x29)+(?&fws)?|(?&fws))(?<quot>(?&cfws)?\x22(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]+|\x5c[\x00-\x7f]))*(?&fws)?\x22(?&cfws)?)(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<dot>(?&cfws)?(?&atext)(?>\x2e(?&atext))*(?&cfws)?))((?&dot)|(?&quot)|(?>(?&cfws)?(?&atext)(?&cfws)?|(?&quot))(?>\x2e(?>(?&cfws)?(?&atext)(?&cfws)?|(?&quot)))*)\x40((?&dot)|(?&cfws)?\x5b(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x5e-\x7f]+|\x5c[\x00-\x7f]))*(?&fws)?\x5d(?&cfws)?|(?&cfws)?(?&atext)(?&cfws)?(?>\x2e(?&cfws)?(?&atext)(?&cfws)?)*)\z/Su
     
 # RFC 5322 and RFC 6531 Without Comments
 
-    /^(?(DEFINE)(?<fws>(?>[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?>(?>\x0d\x0a)?[\x09\x20]+)+)(?<quot>(?&fws)?\x22(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]+|\x5c[\x00-\x7f]))*(?&fws)?\x22(?&fws)?)(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<dot>(?&fws)?(?&atext)(?>\x2e(?&atext))*(?&fws)?))((?&dot)|(?&quot)|(?>(?&fws)?(?&atext)(?&fws)?|(?&quot))(?>\x2e(?>(?&fws)?(?&atext)(?&fws)?|(?&quot)))*)\x40((?&dot)|(?&fws)?\x5b(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x5e-\x7f]+|\x5c[\x00-\x7f]))*(?&fws)?\x5d(?&fws)?|(?&fws)?(?&atext)(?&fws)?(?>\x2e(?&fws)?(?&atext)(?&fws)?)*)$/muS
+    /\A(?(DEFINE)(?<fws>(?>(?>\x0d\x0a)?[\x09\x20]+)+)(?<quot>(?&fws)?\x22(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]+|\x5c[\x00-\x7f]))*(?&fws)?\x22(?&fws)?)(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<dot>(?&fws)?(?&atext)(?>\x2e(?&atext))*(?&fws)?))((?&dot)|(?&quot)|(?>(?&fws)?(?&atext)(?&fws)?|(?&quot))(?>\x2e(?>(?&fws)?(?&atext)(?&fws)?|(?&quot)))*)\x40((?&dot)|(?&fws)?\x5b(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x5e-\x7f]+|\x5c[\x00-\x7f]))*(?&fws)?\x5d(?&fws)?|(?&fws)?(?&atext)(?&fws)?(?>\x2e(?&fws)?(?&atext)(?&fws)?)*)\z/Su
     
 # RFC 5322 and RFC 6531 Without Obsolete Syntax
 
-    /^(?(DEFINE)(?<fws>(?>[\x09\x20]*\x0d\x0a)?[\x09\x20]+)(?<cfws>(?>(?&fws)?(\x28(?>(?&fws)?(?>[\x21-\x27\x2a-\x5b\x5d-\x7e]+|\x5c[\x09\x20-\x7e]|(?&cfws)))*(?&fws)?\x29))+(?&fws)?|(?&fws))(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<dot>(?&cfws)?(?&atext)(?>\x2e(?&atext))*(?&cfws)?))((?&dot)|(?&cfws)?\x22(?>(?&fws)?(?>[\x21\x23-\x5b\x5d-\x7e]+|\x5c[\x09\x20-\x7e]))*(?&fws)?\x22(?&cfws)?)\x40((?&dot)|(?&cfws)?\x5b(?>(?&fws)?[\x21-\x5a\x5e-\x7e]+)*(?&fws)?\x5d(?&cfws)?)$/muS
+    /\A(?(DEFINE)(?<fws>(?>[\x09\x20]*\x0d\x0a)?[\x09\x20]+)(?<cfws>(?>(?&fws)?\x28(?>(?&fws)?(?>[\x21-\x27\x2a-\x5b\x5d-\x7e]+|\x5c[\x09\x20-\x7e]|(?&cfws)))*(?&fws)?\x29)+(?&fws)?|(?&fws))(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<dot>(?&cfws)?(?&atext)(?>\x2e(?&atext))*(?&cfws)?))((?&dot)|(?&cfws)?\x22(?>(?&fws)?(?>[\x21\x23-\x5b\x5d-\x7e]+|\x5c[\x09\x20-\x7e]))*(?&fws)?\x22(?&cfws)?)\x40((?&dot)|(?&cfws)?\x5b(?>(?&fws)?[\x21-\x5a\x5e-\x7e]+)*(?&fws)?\x5d(?&cfws)?)\z/Su
     
 # RFC 5322 and RFC 6531 Without Comments and Without Obsolete Syntax
 
-    /^(?(DEFINE)(?<fws>(?>[\x09\x20]*\x0d\x0a)?[\x09\x20]+)(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<dot>(?&fws)?(?&atext)(?>\x2e(?&atext))*(?&fws)?))((?&dot)|(?&fws)?\x22(?>(?&fws)?(?>[\x21\x23-\x5b\x5d-\x7e]+|\x5c[\x09\x20-\x7e]))*(?&fws)?\x22(?&fws)?)\x40((?&dot)|(?&fws)?\x5b(?>(?&fws)?[\x21-\x5a\x5e-\x7e]+)*(?&fws)?\x5d(?&fws)?)$/muS
+    /\A(?(DEFINE)(?<fws>(?>[\x09\x20]*\x0d\x0a)?[\x09\x20]+)(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<dot>(?&fws)?(?&atext)(?>\x2e(?&atext))*(?&fws)?))((?&dot)|(?&fws)?\x22(?>(?&fws)?(?>[\x21\x23-\x5b\x5d-\x7e]+|\x5c[\x09\x20-\x7e]))*(?&fws)?\x22(?&fws)?)\x40((?&dot)|(?&fws)?\x5b(?>(?&fws)?[\x21-\x5a\x5e-\x7e]+)*(?&fws)?\x5d(?&fws)?)\z/Su
Updated by Joran Rood

File email-regular-expressions.md Modified

  • Ignore whitespace
  • Hide word diff
 # Full RFC 5322 and RFC 6531
 
-    /^(?(DEFINE)(?<fws>(?>[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?>(?>\x0d\x0a)?[\x09\x20])+)(?<cfws>(?>(?&fws)?(\x28(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]|(?&cfws)))*(?&fws)?\x29))+(?&fws)?|(?&fws))(?<qstr>(?&cfws)?\x22(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]))*(?&fws)?\x22(?&cfws)?)(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<datom>(?&cfws)?(?&atext)(?>\x2e(?&atext))*(?&cfws)?))(?>(?&datom)|(?&qstr)|(?>(?&cfws)?(?&atext)(?&cfws)?|(?&qstr))(?>\x2e(?>(?&cfws)?(?&atext)(?&cfws)?|(?&qstr)))*)\x40(?>(?&datom)|(?&cfws)?\x5b(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x5e-\x7f]|\x5c[\x00-\x7f]))*(?&fws)?\x5d(?&cfws)?|(?&cfws)?(?&atext)(?&cfws)?(?>\x2e(?&cfws)?(?&atext)(?&cfws)?)*)$/muS
+    /^(?(DEFINE)(?<fws>(?>[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?>(?>\x0d\x0a)?[\x09\x20]+)+)(?<cfws>(?>(?&fws)?(\x28(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]+|\x5c[\x00-\x7f]|(?&cfws)))*(?&fws)?\x29))+(?&fws)?|(?&fws))(?<quot>(?&cfws)?\x22(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]+|\x5c[\x00-\x7f]))*(?&fws)?\x22(?&cfws)?)(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<dot>(?&cfws)?(?&atext)(?>\x2e(?&atext))*(?&cfws)?))((?&dot)|(?&quot)|(?>(?&cfws)?(?&atext)(?&cfws)?|(?&quot))(?>\x2e(?>(?&cfws)?(?&atext)(?&cfws)?|(?&quot)))*)\x40((?&dot)|(?&cfws)?\x5b(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x5e-\x7f]+|\x5c[\x00-\x7f]))*(?&fws)?\x5d(?&cfws)?|(?&cfws)?(?&atext)(?&cfws)?(?>\x2e(?&cfws)?(?&atext)(?&cfws)?)*)$/muS
     
 # RFC 5322 and RFC 6531 Without Comments
 
-    /^(?(DEFINE)(?<fws>(?>[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?>(?>\x0d\x0a)?[\x09\x20])+)(?<qstr>(?&fws)?\x22(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]))*(?&fws)?\x22(?&fws)?)(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<datom>(?&fws)?(?&atext)(?>\x2e(?&atext))*(?&fws)?))(?>(?&datom)|(?&qstr)|(?>(?&fws)?(?&atext)(?&fws)?|(?&qstr))(?>\x2e(?>(?&fws)?(?&atext)(?&fws)?|(?&qstr)))*)\x40(?>(?&datom)|(?&fws)?\x5b(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x5e-\x7f]|\x5c[\x00-\x7f]))*(?&fws)?\x5d(?&fws)?|(?&fws)?(?&atext)(?&fws)?(?>\x2e(?&fws)?(?&atext)(?&fws)?)*)$/muS
+    /^(?(DEFINE)(?<fws>(?>[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?>(?>\x0d\x0a)?[\x09\x20]+)+)(?<quot>(?&fws)?\x22(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]+|\x5c[\x00-\x7f]))*(?&fws)?\x22(?&fws)?)(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<dot>(?&fws)?(?&atext)(?>\x2e(?&atext))*(?&fws)?))((?&dot)|(?&quot)|(?>(?&fws)?(?&atext)(?&fws)?|(?&quot))(?>\x2e(?>(?&fws)?(?&atext)(?&fws)?|(?&quot)))*)\x40((?&dot)|(?&fws)?\x5b(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x5e-\x7f]+|\x5c[\x00-\x7f]))*(?&fws)?\x5d(?&fws)?|(?&fws)?(?&atext)(?&fws)?(?>\x2e(?&fws)?(?&atext)(?&fws)?)*)$/muS
     
 # RFC 5322 and RFC 6531 Without Obsolete Syntax
 
-    /^(?(DEFINE)(?<fws>(?>[\x09\x20]*\x0d\x0a)?[\x09\x20]+)(?<cfws>(?>(?&fws)?(\x28(?>(?&fws)?(?>[\x21-\x27\x2a-\x5b\x5d-\x7e]|\x5c[\x09\x20-\x7e]|(?&cfws)))*(?&fws)?\x29))+(?&fws)?|(?&fws))(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<datom>(?&cfws)?(?&atext)(?>\x2e(?&atext))*(?&cfws)?))(?>(?&datom)|(?&cfws)?\x22(?>(?&fws)?(?>[\x21\x23-\x5b\x5d-\x7e]|\x5c[\x09\x20-\x7e]))*(?&fws)?\x22(?&cfws)?)\x40(?>(?&datom)|(?&cfws)?\x5b(?>(?&fws)?[\x21-\x5a\x5e-\x7e])*(?&fws)?\x5d(?&cfws)?)$/muS
+    /^(?(DEFINE)(?<fws>(?>[\x09\x20]*\x0d\x0a)?[\x09\x20]+)(?<cfws>(?>(?&fws)?(\x28(?>(?&fws)?(?>[\x21-\x27\x2a-\x5b\x5d-\x7e]+|\x5c[\x09\x20-\x7e]|(?&cfws)))*(?&fws)?\x29))+(?&fws)?|(?&fws))(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<dot>(?&cfws)?(?&atext)(?>\x2e(?&atext))*(?&cfws)?))((?&dot)|(?&cfws)?\x22(?>(?&fws)?(?>[\x21\x23-\x5b\x5d-\x7e]+|\x5c[\x09\x20-\x7e]))*(?&fws)?\x22(?&cfws)?)\x40((?&dot)|(?&cfws)?\x5b(?>(?&fws)?[\x21-\x5a\x5e-\x7e]+)*(?&fws)?\x5d(?&cfws)?)$/muS
     
 # RFC 5322 and RFC 6531 Without Comments and Without Obsolete Syntax
 
-    /^(?(DEFINE)(?<fws>(?>[\x09\x20]*\x0d\x0a)?[\x09\x20]+)(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<datom>(?&fws)?(?&atext)(?>\x2e(?&atext))*(?&fws)?))(?>(?&datom)|(?&fws)?\x22(?>(?&fws)?(?>[\x21\x23-\x5b\x5d-\x7e]|\x5c[\x09\x20-\x7e]))*(?&fws)?\x22(?&fws)?)\x40(?>(?&datom)|(?&fws)?\x5b(?>(?&fws)?[\x21-\x5a\x5e-\x7e])*(?&fws)?\x5d(?&fws)?)$/muS
+    /^(?(DEFINE)(?<fws>(?>[\x09\x20]*\x0d\x0a)?[\x09\x20]+)(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<dot>(?&fws)?(?&atext)(?>\x2e(?&atext))*(?&fws)?))((?&dot)|(?&fws)?\x22(?>(?&fws)?(?>[\x21\x23-\x5b\x5d-\x7e]+|\x5c[\x09\x20-\x7e]))*(?&fws)?\x22(?&fws)?)\x40((?&dot)|(?&fws)?\x5b(?>(?&fws)?[\x21-\x5a\x5e-\x7e]+)*(?&fws)?\x5d(?&fws)?)$/muS
Updated by Joran Rood

File email-regular-expressions.md Modified

  • Ignore whitespace
  • Hide word diff
 # Full RFC 5322 and RFC 6531
 
-    /^(?(DEFINE)(?<fws>(?>[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?>(?>\x0d\x0a)?[\x09\x20])+)(?<cfws>(?>(?&fws)?(\x28(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]|(?-1)))*(?&fws)?\x29))+(?&fws)?|(?&fws))(?<qstr>(?&cfws)?\x22(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]))*(?&fws)?\x22(?&cfws)?)(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<datom>(?&cfws)?(?&atext)(?>\x2e(?&atext))*(?&cfws)?))(?>(?&datom)|(?&qstr)|(?>(?&cfws)?(?&atext)(?&cfws)?|(?&qstr))(?>\x2e(?>(?&cfws)?(?&atext)(?&cfws)?|(?&qstr)))*)\x40(?>(?&datom)|(?&cfws)?\x5b(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x5e-\x7f]|\x5c[\x00-\x7f]))*(?&fws)?\x5d(?&cfws)?|(?&cfws)?(?&atext)(?&cfws)?(?>\x2e(?&cfws)?(?&atext)(?&cfws)?)*)$/muS
+    /^(?(DEFINE)(?<fws>(?>[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?>(?>\x0d\x0a)?[\x09\x20])+)(?<cfws>(?>(?&fws)?(\x28(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]|(?&cfws)))*(?&fws)?\x29))+(?&fws)?|(?&fws))(?<qstr>(?&cfws)?\x22(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]))*(?&fws)?\x22(?&cfws)?)(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<datom>(?&cfws)?(?&atext)(?>\x2e(?&atext))*(?&cfws)?))(?>(?&datom)|(?&qstr)|(?>(?&cfws)?(?&atext)(?&cfws)?|(?&qstr))(?>\x2e(?>(?&cfws)?(?&atext)(?&cfws)?|(?&qstr)))*)\x40(?>(?&datom)|(?&cfws)?\x5b(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x5e-\x7f]|\x5c[\x00-\x7f]))*(?&fws)?\x5d(?&cfws)?|(?&cfws)?(?&atext)(?&cfws)?(?>\x2e(?&cfws)?(?&atext)(?&cfws)?)*)$/muS
     
 # RFC 5322 and RFC 6531 Without Comments
 
     
 # RFC 5322 and RFC 6531 Without Obsolete Syntax
 
-    /^(?(DEFINE)(?<fws>(?>[\x09\x20]*\x0d\x0a)?[\x09\x20]+)(?<cfws>(?>(?&fws)?(\x28(?>(?&fws)?(?>[\x21-\x27\x2a-\x5b\x5d-\x7e]|\x5c[\x09\x20-\x7e]|(?-1)))*(?&fws)?\x29))+(?&fws)?|(?&fws))(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<datom>(?&cfws)?(?&atext)(?>\x2e(?&atext))*(?&cfws)?))(?>(?&datom)|(?&cfws)?\x22(?>(?&fws)?(?>[\x21\x23-\x5b\x5d-\x7e]|\x5c[\x09\x20-\x7e]))*(?&fws)?\x22(?&cfws)?)\x40(?>(?&datom)|(?&cfws)?\x5b(?>(?&fws)?[\x21-\x5a\x5e-\x7e])*(?&fws)?\x5d(?&cfws)?)$/muS
+    /^(?(DEFINE)(?<fws>(?>[\x09\x20]*\x0d\x0a)?[\x09\x20]+)(?<cfws>(?>(?&fws)?(\x28(?>(?&fws)?(?>[\x21-\x27\x2a-\x5b\x5d-\x7e]|\x5c[\x09\x20-\x7e]|(?&cfws)))*(?&fws)?\x29))+(?&fws)?|(?&fws))(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<datom>(?&cfws)?(?&atext)(?>\x2e(?&atext))*(?&cfws)?))(?>(?&datom)|(?&cfws)?\x22(?>(?&fws)?(?>[\x21\x23-\x5b\x5d-\x7e]|\x5c[\x09\x20-\x7e]))*(?&fws)?\x22(?&cfws)?)\x40(?>(?&datom)|(?&cfws)?\x5b(?>(?&fws)?[\x21-\x5a\x5e-\x7e])*(?&fws)?\x5d(?&cfws)?)$/muS
     
 # RFC 5322 and RFC 6531 Without Comments and Without Obsolete Syntax
 
Updated by Joran Rood

File email-regular-expressions.md Modified

  • Ignore whitespace
  • Hide word diff
 # Full RFC 5322 and RFC 6531
 
-    /^(?:(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?|(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+))?[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]+(?:\x2e[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]+)*(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?|(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+))?|(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?|(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+))?\x22(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x22(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?|(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+))?|(?:(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?|(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+))?[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]+(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?|(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+))?|(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?|(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+))?\x22(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x22(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?|(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+))?)(?:\x2e(?:(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?|(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+))?[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]+(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?|(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+))?|(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?|(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+))?\x22(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x22(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?|(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+))?))*)\x40(?:(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?|(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+))?[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]+(?:\x2e[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]+)*(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?|(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+))?|(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?|(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+))?\x5b(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x5e-\x7f]|\x5c[\x00-\x7f]))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x5d(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?|(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+))?|(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?|(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+))?[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]+(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?|(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+))?(?:\x2e(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?|(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+))?[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]+(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?|(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+))?)*)$/muS
+    /^(?(DEFINE)(?<fws>(?>[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?>(?>\x0d\x0a)?[\x09\x20])+)(?<cfws>(?>(?&fws)?(\x28(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x27\x2a-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]|(?-1)))*(?&fws)?\x29))+(?&fws)?|(?&fws))(?<qstr>(?&cfws)?\x22(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]))*(?&fws)?\x22(?&cfws)?)(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<datom>(?&cfws)?(?&atext)(?>\x2e(?&atext))*(?&cfws)?))(?>(?&datom)|(?&qstr)|(?>(?&cfws)?(?&atext)(?&cfws)?|(?&qstr))(?>\x2e(?>(?&cfws)?(?&atext)(?&cfws)?|(?&qstr)))*)\x40(?>(?&datom)|(?&cfws)?\x5b(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x5e-\x7f]|\x5c[\x00-\x7f]))*(?&fws)?\x5d(?&cfws)?|(?&cfws)?(?&atext)(?&cfws)?(?>\x2e(?&cfws)?(?&atext)(?&cfws)?)*)$/muS
     
 # RFC 5322 and RFC 6531 Without Comments
 
-    /^(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]+(?:\x2e[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]+)*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?|(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x22(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x22(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?|(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?|(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x22(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x22(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?)(?:\x2e(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?|(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x22(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x22(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?))*)\x40(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]+(?:\x2e[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]+)*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?|(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x5b(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x5e-\x7f]|\x5c[\x00-\x7f]))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?\x5d(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?|(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?(?:\x2e(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?:(?:\x0d\x0a)?[\x09\x20])+)?)*)$/muS
+    /^(?(DEFINE)(?<fws>(?>[\x09\x20]*\x0d\x0a)?[\x09\x20]+|(?>(?>\x0d\x0a)?[\x09\x20])+)(?<qstr>(?&fws)?\x22(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\x5c[\x00-\x7f]))*(?&fws)?\x22(?&fws)?)(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<datom>(?&fws)?(?&atext)(?>\x2e(?&atext))*(?&fws)?))(?>(?&datom)|(?&qstr)|(?>(?&fws)?(?&atext)(?&fws)?|(?&qstr))(?>\x2e(?>(?&fws)?(?&atext)(?&fws)?|(?&qstr)))*)\x40(?>(?&datom)|(?&fws)?\x5b(?>(?&fws)?(?>[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x5e-\x7f]|\x5c[\x00-\x7f]))*(?&fws)?\x5d(?&fws)?|(?&fws)?(?&atext)(?&fws)?(?>\x2e(?&fws)?(?&atext)(?&fws)?)*)$/muS
     
 # RFC 5322 and RFC 6531 Without Obsolete Syntax
 
-    /^(?:(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?(?:[\x21-\x27\x2a-\x5b\x5d-\x7e]|\x5c[\x09\x20-\x7e]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?|(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]+(?:\x2e[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]+)*(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?(?:[\x21-\x27\x2a-\x5b\x5d-\x7e]|\x5c[\x09\x20-\x7e]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?|(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?|(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?(?:[\x21-\x27\x2a-\x5b\x5d-\x7e]|\x5c[\x09\x20-\x7e]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?|(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?\x22(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?(?:[\x21\x23-\x5b\x5d-\x7e]|\x5c[\x09\x20-\x7e]))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?\x22(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?(?:[\x21-\x27\x2a-\x5b\x5d-\x7e]|\x5c[\x09\x20-\x7e]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?|(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?)\x40(?:(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?(?:[\x21-\x27\x2a-\x5b\x5d-\x7e]|\x5c[\x09\x20-\x7e]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?|(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]+(?:\x2e[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]+)*(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?(?:[\x21-\x27\x2a-\x5b\x5d-\x7e]|\x5c[\x09\x20-\x7e]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?|(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?|(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?(?:[\x21-\x27\x2a-\x5b\x5d-\x7e]|\x5c[\x09\x20-\x7e]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?|(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?\x5b(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?[\x21-\x5a\x5e-\x7e])*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?\x5d(?:(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?(\x28(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?(?:[\x21-\x27\x2a-\x5b\x5d-\x7e]|\x5c[\x09\x20-\x7e]|(?-1)))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?\x29))+(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?|(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?)$/muS
+    /^(?(DEFINE)(?<fws>(?>[\x09\x20]*\x0d\x0a)?[\x09\x20]+)(?<cfws>(?>(?&fws)?(\x28(?>(?&fws)?(?>[\x21-\x27\x2a-\x5b\x5d-\x7e]|\x5c[\x09\x20-\x7e]|(?-1)))*(?&fws)?\x29))+(?&fws)?|(?&fws))(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<datom>(?&cfws)?(?&atext)(?>\x2e(?&atext))*(?&cfws)?))(?>(?&datom)|(?&cfws)?\x22(?>(?&fws)?(?>[\x21\x23-\x5b\x5d-\x7e]|\x5c[\x09\x20-\x7e]))*(?&fws)?\x22(?&cfws)?)\x40(?>(?&datom)|(?&cfws)?\x5b(?>(?&fws)?[\x21-\x5a\x5e-\x7e])*(?&fws)?\x5d(?&cfws)?)$/muS
     
 # RFC 5322 and RFC 6531 Without Comments and Without Obsolete Syntax
 
-    /^(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]+(?:\x2e[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]+)*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?|(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?\x22(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?(?:[\x21\x23-\x5b\x5d-\x7e]|\x5c[\x09\x20-\x7e]))*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?\x22(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?)\x40(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]+(?:\x2e[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]+)*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?|(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?\x5b(?:(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?[\x21-\x5a\x5e-\x7e])*(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?\x5d(?:(?:[\x09\x20]*\x0d\x0a)?[\x09\x20]+)?)$/muS
+    /^(?(DEFINE)(?<fws>(?>[\x09\x20]*\x0d\x0a)?[\x09\x20]+)(?<atext>[\x21\x23-\x27\x2a\x2b\x2d\x2f-\x39\x3d\x3f\x41-\x5a\x5e-\x7e\x{80}-\x{10ffff}]++)(?<datom>(?&fws)?(?&atext)(?>\x2e(?&atext))*(?&fws)?))(?>(?&datom)|(?&fws)?\x22(?>(?&fws)?(?>[\x21\x23-\x5b\x5d-\x7e]|\x5c[\x09\x20-\x7e]))*(?&fws)?\x22(?&fws)?)\x40(?>(?&datom)|(?&fws)?\x5b(?>(?&fws)?[\x21-\x5a\x5e-\x7e])*(?&fws)?\x5d(?&fws)?)$/muS
  1. 1
  2. 2
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.