Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {-# LANGUAGE OverloadedStrings #-}
- import Text.Regex.TDFA ((=~))
- getMessage :: String -> String
- getMessage s =
- let regex = "PRIVMSG\\s+\\S+\\s+:(.*)" :: String
- matches = s =~ regex :: [[String]]
- in case matches of
- (match:_) -> match !! 1
- _ -> ""
- main :: IO ()
- main = do
- let input = ":fox!~tf-f@2a02:8070:a287:3800:d9ab:3d2f:8422:9afa PRIVMSG ##investments :Test"
- print $ getMessage input
Advertisement
Add Comment
Please, Sign In to add comment