fork download
  1. re =/(?<addr_spec> \g<local_part> @ \g<domain> ){0}
  2. (?<local_part> \g<dot_atom> | \g<quoted_string> | \g<obs_local_part> ){0}
  3. (?<domain> \g<dot_atom> | \g<domain_literal> | \g<obs_domain> ){0}
  4. (?<domain_literal> \g<CFWS>? \[ (?: \g<FWS>? \g<dtext> )* \g<FWS>? \] \g<CFWS>? ){0}
  5. (?<dtext> [\x21-\x5a] | [\x5e-\x7e] | \g<obs_dtext> ){0}
  6. (?<quoted_pair> \\ (?: \g<VCHAR> | \g<WSP> ) | \g<obs_qp> ){0}
  7. (?<dot_atom> \g<CFWS>? \g<dot_atom_text> \g<CFWS>? ){0}
  8. (?<dot_atom_text> \g<atext> (?: \. \g<atext> )* ){0}
  9. (?<atext> [a-zA-Z0-9!#$%&'*+\/=?^_`{|}~-]+ ){0}
  10. (?<atom> \g<CFWS>? \g<atext> \g<CFWS>? ){0}
  11. (?<word> \g<atom> | \g<quoted_string> ){0}
  12. (?<quoted_string> \g<CFWS>? " (?: \g<FWS>? \g<qcontent> )* \g<FWS>? " \g<CFWS>? ){0}
  13. (?<qcontent> \g<qtext> | \g<quoted_pair> ){0}
  14. (?<qtext> \x21 | [\x23-\x5b] | [\x5d-\x7e] | \g<obs_qtext> ){0}
  15. # comments and whitespace
  16. (?<FWS> (?: \g<WSP>* \r\n )? \g<WSP>+ | \g<obs_FWS> ){0}
  17. (?<CFWS> (?: \g<FWS>? \g<comment> )+ \g<FWS>? | \g<FWS> ){0}
  18. (?<comment> \( (?: \g<FWS>? \g<ccontent> )* \g<FWS>? \) ){0}
  19. (?<ccontent> \g<ctext> | \g<quoted_pair> | \g<comment> ){0}
  20. (?<ctext> [\x21-\x27] | [\x2a-\x5b] | [\x5d-\x7e] | \g<obs_ctext> ){0}
  21. # obsolete tokens
  22. (?<obs_domain> \g<atom> (?: \. \g<atom> )* ){0}
  23. (?<obs_local_part> \g<word> (?: \. \g<word> )* ){0}
  24. (?<obs_dtext> \g<obs_NO_WS_CTL> | \g<quoted_pair> ){0}
  25. (?<obs_qp> \\ (?: \x00 | \g<obs_NO_WS_CTL> | \n | \r ) ){0}
  26. (?<obs_FWS> \g<WSP>+ (?: \r\n \g<WSP>+ )* ){0}
  27. (?<obs_ctext> \g<obs_NO_WS_CTL> ){0}
  28. (?<obs_qtext> \g<obs_NO_WS_CTL> ){0}
  29. (?<obs_NO_WS_CTL> [\x01-\x08] | \x0b | \x0c | [\x0e-\x1f] | \x7f ){0}
  30. # character class definitions
  31. (?<VCHAR> [\x21-\x7E] ){0}
  32. (?<WSP> [ \t] ){0}
  33. ^\g<addr_spec>$/x
  34.  
  35. p re.match?('+1~1+@iana.org')
  36. p re.match?('test@[123.123.123.123')
Success #stdin #stdout 0s 6632KB
stdin
Standard input is empty
stdout
true
false