Guest User

Untitled

a guest
Nov 30th, 2024
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {-# LANGUAGE OverloadedStrings #-}
  2.  
  3. import Text.Regex.TDFA ((=~))
  4.  
  5.  
  6. getMessage :: String -> String
  7. getMessage s =
  8.     let regex = "PRIVMSG\\s+\\S+\\s+:(.*)" :: String
  9.         matches = s =~ regex :: [[String]]
  10.     in case matches of
  11.         (match:_) -> match !! 1
  12.         _         -> ""        
  13.  
  14.  
  15. main :: IO ()
  16. main = do
  17.     let input = ":fox!~tf-f@2a02:8070:a287:3800:d9ab:3d2f:8422:9afa PRIVMSG ##investments :Test"
  18.     print $ getMessage input
Advertisement
Add Comment
Please, Sign In to add comment