[TRE-general] [Fwd: Re: Why Retest fail on these?]

Anderson Wilson adwilson at terra.com.br
Wed Feb 21 15:30:42 EET 2007


Sorry for the stupid question.
I just figured out why...

thanks for your time

Anderson

-------- Original Message --------
Subject: 	Re: [TRE-general] Why Retest fail on these?
Date: 	Wed, 21 Feb 2007 09:59:06 -0300
From: 	OcTweak <octweak at terra.com.br>
To: 	tre-general at lists.laurikari.net
References: 	<sfid-H20070221-113038-+029.34-1 at spamfilter.osbf.lua> 
<45DB57A9.2010800 at terra.com.br> <20070221103104.GE16851 at laurikari.net>



If \xhh does not work inside [],
how does retest correctly works for the following:

 test_comp("[\\x30\\x31]\\x41", REG_EXTENDED, 0);
 test_exec("0ABC", 0, REG_OK, 0, 2, END);
 test_exec("1ABC", 0, REG_OK, 0, 2, END);
 test_exec("2ABC", 0, REG_NOMATCH);

 test_comp("[^\\x30\\x31]\\x41", REG_EXTENDED, 0);
 test_exec("0ABC", 0, REG_NOMATCH);
 test_exec("1ABC", 0, REG_NOMATCH);
 test_exec("2ABC", 0, REG_OK, 0, 2, END);

thanks

Anderson


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);
>
> --
> http://www.iki.fi/vl/
>
>
>   




More information about the TRE-general mailing list