import Text.Parsers.Frisby import System findAllMatches r = mdo regex <- r tryAgain <- newRule $ regex <> tryAgain ## uncurry (:) // anyChar ->> tryAgain // unit [] return $ tryAgain main = do [xs] <- getArgs showRegex xs c <- getContents let rx = regex xs print $ runPeg (findAllMatches rx) c