[TRE-general] Why Retest fail on these?

skaller skaller at users.sourceforge.net
Wed Feb 21 13:27:48 EET 2007


On Wed, 2007-02-21 at 12:31 +0200, Ville Laurikari wrote:
> On Tue, Feb 20, 2007 at 05:18:49PM -0300, OcTweak wrote:
> > Could someone explain me why these tests fail?
> >
> > test_comp("[\\x0D\\x0A]\\x41", REG_EXTENDED, 0);
> > test_exec("\nABC4", 0, REG_OK, 0, 2, END);
> > test_exec("\rABC5", 0, REG_OK, 0, 2, END);
> 
> They fail because \xhh (where "hh" is a hex byte) does not work within
> a bracket expression.  I'd have to check to be 100% sure, but I think
> POSIX explicitly says that the '\' character loses its special meaning
> within brackets.
> 
> This, for example, does work:
>    test_comp("(?:\\x0D|\\x0A)\\x41", REG_EXTENDED, 0);
>    test_exec("\nABC4", 0, REG_OK, 0, 2, END);
>    test_exec("\rABC5", 0, REG_OK, 0, 2, END);
> 

A good argument for a combinator based interface?

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


More information about the TRE-general mailing list