According to a number of tutorials (including Real World Haskell) one can, using ghci do the following
ghci > :m Text.Regex.Posix
ghci > \"foo foo foo\
The regex libraries can be somewhat confusing with their overloaded return types, but to get all the matches you just need to ensure that the return type is AllTextMatches
, for example:
Prelude> :m + Text.Regex.Posix
Prelude Text.Regex.Posix> getAllTextMatches $ "foo foo foo" =~ "foo" :: [String]
["foo","foo","foo"]