Guest User

Untitled

a guest
Jul 13th, 2018
508
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. Email address: RFC 2822
  2. This regular expression implements the official RFC 2822 standard for email addresses. Using this regular expression in actual applications is NOT recommended. It is shown to illustrate that with regular expressions there's always a trade-off between what's exact and what's practical.
  3.  
  4. (?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?: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]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])
  5.  
  6. sample results
  7.  
  8. maches
  9. rich@[192.168.1.10]
  10. FirstName@somehost.com
  11. FirstName@[192.168.1.10]
  12. brian@foo.bar
  13.  
  14. noMatch
  15. "First Name"@somehost.com
  16. "Firsr Name"@[192.168.1.10]
  17.  
  18.  
  19. ---------
  20.  
  21. Email address: RFC 2822 (simplified)
  22. Matches a normal email address. Does not check the top-level domain.
  23. Requires the "case insensitive" option to be ON.
  24.  
  25. [a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?
  26.  
  27. sample resutls
  28.  
  29. maches
  30. FirstName@somehost.com
  31. brian@foo.bar
  32.  
  33. noMatch
  34. "First Name"@somehost.com
  35. "Firsr Name"@[192.168.1.10]
  36. rich@[192.168.1.10]
  37. FirstName@[192.168.1.10]
  38.  
  39.  
  40. ---------
  41.  
  42. or... just not empty?
Add Comment
Please, Sign In to add comment