Skip to content
This repository has been archived by the owner on May 30, 2022. It is now read-only.

Commit

Permalink
feature(util): Make email regex part of util api
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianlee44 committed Nov 8, 2013
1 parent 110088e commit 0627e31
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/util.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ angular.module("Mac.Util", []).factory "util", [
]*)?
///i

_emailRegex: /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/

validateUrl: (url) ->
match = @_urlRegex.exec url
if match?
Expand All @@ -178,9 +180,7 @@ angular.module("Mac.Util", []).factory "util", [
match["url"] = match.url
match

validateEmail: (email) ->
emailRegex = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/
emailRegex.test email
validateEmail: (email) -> @_emailRegex.test email

# credits: http://www.netlobo.com/url_query_string_javascript.html
getQueryString: (url, name = "") ->
Expand Down

0 comments on commit 0627e31

Please sign in to comment.