Created
July 18, 2016 04:32
-
-
Save zkessin/e19640130ba33099a9c209b98b012815 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Module MatchEmail exposing (..) | |
import Regex exposing (..) | |
bodyHasEmail : String -> Maybe String | |
bodyHasEmail bodyText = | |
let -- "\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b" | |
re = regex "\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b" | |
|> caseInsensitive | |
limit =(AtMost 1) | |
match = find limit re bodyText | |
in | |
case head match of | |
Nothing -> Nothing | |
Just email -> Just email.match |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment