[TRE-general] Why Retest fail on these?

Ville Laurikari ville at laurikari.net
Wed Feb 21 12:31:04 EET 2007


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);

--
http://www.iki.fi/vl/


More information about the TRE-general mailing list