
On Wed, Jun 6, 2012 at 10:08 PM, Rico Moorman
If this is correct ... I am still a little lost though. I cannot come up with a way of matching the actual String out of the MatchText returned by matchOnceText ... http://hackage.haskell.org/packages/archive/regex-base/latest/doc/html/Text-...
MatchText is an array, which allows for captures in the regex, for instance, if matching "hello Abel ! And goodbye." with "hello (\w+) ([.!?])", MatchText would be : array (0,2) [(0,("hello Abel !",(0,12))), (1,("Abel",(6,4))), (2,("!",(11,1)))] So if you want the whole matched text, you would use :
fst (match ! 0)
Or you could just use matchM :
go text = case RE.matchM regex' text of Just (before, match, after) -> before ++ replace' match ++ go after _ -> text
and have match be a string, just like before (since you don't use all the power of MatchText anyway). -- Jedaï