import Text.Regex import Data.Maybe (fromJust) mail :: Regex mail = mkRegex "[a-zA-Z0-9]+@[a-zA-Z0-9]+" mailmatch :: String -> [String] mailmatch s = fromJust $ matchRegex mail s main = do s <- readFile "names" print $ map mailmatch $ lines s