haskell-hvr / regex-tdfa

Pure Haskell Tagged DFA Backend for "Text.Regex" (regex-base)
http://hackage.haskell.org/package/regex-tdfa
Other
36 stars 9 forks source link

How to get the list of all submatches? #18

Closed Munksgaard closed 3 years ago

Munksgaard commented 3 years ago

There are a lot of helpful examples in the README, but I cannot figure out how to get the list of all submatches. I thought it would be something like a =~ b :: [(String, String, String, [String])], but that does not seem to work for me.

yutotakano commented 3 years ago

I believe you can cast it to [[String]] to get a list of lists containing the full match and submatches for each one. From there, perhaps a concat . map tail would do.