Created
May 5, 2010 18:31
-
-
Save duairc/391235 to your computer and use it in GitHub Desktop.
This file contains 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
import Data.Char | |
atLeastOneFollowedByAndThen f c g [] = False | |
atLeastOneFollowedByAndThen f c g (x:xs) = f x && yys /= [] && y == c && g ys | |
where yys = dropWhile f xs | |
~(y:ys) = yys | |
isEmail = atLeastOneFollowedByAndThen isAlphaNum '@' isDomain | |
isDomain = atLeastOneFollowedByAndThen isAlphaNum '.' (\t -> isTerminator t || isDomain t) | |
isTerminator = (`elem` ["com", "net", "org", "ie"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment