Snippets
Created by
Joran Rood
last modified
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-\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)|(?")|(?>(?&cfws)?(?&atext)(?&cfws)?|(?"))(?>\x2e(?>(?&cfws)?(?&atext)(?&cfws)?|(?")))*)\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 6532 Without Comments
/\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)|(?")|(?>(?&fws)?(?&atext)(?&fws)?|(?"))(?>\x2e(?>(?&fws)?(?&atext)(?&fws)?|(?")))*)\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 6532 Without Obsolete Syntax
/\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 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\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
Comments (0)
You can clone a snippet to your computer for local editing. Learn more.