RosettaCodeData/Task/Regular-expressions/Haskell/regular-expressions-1.hs

8 lines
155 B
Haskell
Raw Permalink Normal View History

2013-04-10 23:57:08 -07:00
import Text.Regex
str = "I am a string"
case matchRegex (mkRegex ".*string$") str of
Just _ -> putStrLn $ "ends with 'string'"
Nothing -> return ()