[TRE-general] Matching (^) question
Ville Laurikari
ville at laurikari.net
Sat Jan 6 13:11:03 EET 2007
On Fri, Jan 05, 2007 at 09:56:39PM +0000, Chris Kuklewicz wrote:
> Hello,
>
> I am tinkering more with the haskell regex-* packages. In particular I have
> been considering implementing a tagged dfa in pure Haskell.
> >> "searchme" =~ "s(()|^)e" :: Array Int (MatchOffset,MatchLength)
> > array (0,2) [(0,(0,2)),(1,(1,0)),(2,(1,0))]
>
> The above looks sane but re-ordering the alternative causes the match to fail:
>
> >> "searchme" =~ "s(^|())e" :: Array Int (MatchOffset,MatchLength)
> > array (1,0) []
Looks like you've found a bug in TRE. Alternatives where both sides
match an empty string and have different assertions (^ or $) don't
work correctly.
I went through some of the TRE code and found the bug in the regexp
compiler. I know why it doesn't work, but it seems that the fix is
not trivial. Lately I've had limited time (or have chosen to limit my
time) to work on TRE, so I don't know when I'll be able to develop a
fix. It would probably involve rewriting parts of the regexp
compiler...
--
http://www.iki.fi/vl/
More information about the TRE-general
mailing list