Text.Regex bug in ghc 5.04.2

Simon Marlow simonmar@microsoft.com
Fri, 11 Apr 2003 09:26:03 +0100


=20
> After importing Text.Regex and Data.Maybe, here's some output=20
> from ghci:
>=20
> *ProtoRegexp> fromJust $ matchRegex (mkRegex "foo") "barfoobaz"
> []
> *ProtoRegexp> fromJust $ matchRegexAll (mkRegex "foo") "barfoobaz"
> ("ba","foo","baz",[])
>=20
> I'm relatively sure those are both wrong. I think the first should be=20
> "foo"
> and the second should be
> ("bar","foo","baz",[])
>=20
> I haven't yet tried Text.Regex.Posix to see if the problem is=20
> just the wrapper.

The first example is correct (it returns the parenthesised
sub-expressions in the match). =20

The second is indeed incorrect, there's an off-by-one in calculating the
first component of the tuple, which I've now fixed.  Thanks for the
report.

Cheers,
	Simon