regexqq - EXAMPLES ---------------------------------------------------------------------------------------- -- Here is a pasteable-into-ghci version of the below: :m + Text.Regex.PCRE.QQ [$rx|([aeiou]).*(er|ing|tion)([\.,!\?]*)$|] "helloing.!?!?!" [$rx|^([+-])?([0-9]+)\.([0-9]+)|] (show $ negate pi) tail `fmap` [$rx|^([+-])?([0-9]+)\.([0-9]+)|] (show $ negate pi) return . tail =<< [$rx|^([+-])?([0-9]+)\.([0-9]+)|] (show $ negate pi) maybe [] tail $ [$rx|^([+-])?([0-9]+)\.([0-9]+)|] (show $ negate pi) maybe [] tail $ [$rx|^([+-])?([0-9]+)\.([0-9]+)(.*)$|] (show (negate pi) ++ "asdx") ---------------------------------------------------------------------------------------- ghci> :m + Text.Regex.PCRE.QQ ghci> [$rx|([aeiou]).*(er|ing|tion)([\.,!\?]*)$|] "helloing.!?!?!" Just ["elloing.!?!?!","e","ing",".!?!?!"] ghci> [$rx|^([+-])?([0-9]+)\.([0-9]+)|] (show $ negate pi) Just ["-3.141592653589793","-","3","141592653589793"] ghci> tail `fmap` [$rx|^([+-])?([0-9]+)\.([0-9]+)|] (show $ negate pi) Just ["-","3","141592653589793"] ghci> return . tail =<< [$rx|^([+-])?([0-9]+)\.([0-9]+)|] (show $ negate pi) Just ["-","3","141592653589793"] ghci> maybe [] tail $ [$rx|^([+-])?([0-9]+)\.([0-9]+)|] (show $ negate pi) ["-","3","141592653589793"] ghci> maybe [] tail $ [$rx|^([+-])?([0-9]+)\.([0-9]+)(.*)$|] (show (negate pi) ++ "asdx") ["-","3","141592653589793","asdx"] ----------------------------------------------------------------------------------------