fork download
  1. class EmailValidator {
  2. function main(args: String[]) {
  3. var email = "example@domain.com"
  4.  
  5. if (isValidEmail(email)) {
  6. print(email + " is a valid email.")
  7. } else {
  8. print(email + " is not a valid email.")
  9. }
  10. }
  11.  
  12. function isValidEmail(email: String): Boolean {
  13. var regex = "^([a-zA-Z0-9_\\-\\.]+)@([a-zA-Z0-9_\\-\\.]+)\\.([a-zA-Z]{2,5})$"
  14. return email.matches(regex)
  15. }
  16. }
  17.  
Success #stdin #stdout 3.21s 170360KB
stdin
45
stdout
Standard output is empty