import Text.Regex
mail :: Regex
mail = mkRegex "(([a-zA-Z0-9]+[ \t]+)?[a-zA-Z0-9]+[ \t]+)?((mailto://)?[a-zA-Z0-9]+@[a-zA-Z0-9]+(\\.[a-zA-Z0-9]+)+)"
mainmatch s = case m of {
Nothing -> [];
Just (pre, mm, post, sub) -> (sub!!0, sub!!2):mainmatch post
} where m = Text.Regex.matchRegexAll mail s
htmlformat s = "<ul>" ++ (concat $ map htmlformatitem s) ++ "</ul>"
htmlformatitem (name, mail) = if name == ""
then "<li><a href=\"" ++ mail ++ "\"> " ++ mail ++ "</a></li>"
else "<li>" ++ name ++ ", <a href=\"" ++ mail ++ "\"> " ++ mail ++ "</a></li>"
mama = htmlformat $ mainmatch "asdfa sdf as asdf@dgdsfg sdfg@sdfg sdgd ijhb@dfg mailto://u_quark@hotmail.com Lefterhs Kritikos el010149@mail.ntua.gr afta kai alla polla me thn Olga Tremh olga@mega.tv"