Copyright © https://mongoose-os.com

Mongoose OS Forum

frame

slre regex miss match

Hi,
while using slre regex library I have found a strange thing. When I pass to the slre_match function a buffer where string, after s_len charachetrs doesn't end with NULL it doesnt work properly. Here is my example:
i32ResCode = slre_match(READ_ACCESS, CommandStrings.p8Command, CommandStrings.u32Length, CapturedAccessor, 5, 0);
where:
READ_ACCESS = "0-9 [ \r]"
CommandStrings.p8Command is a pointer to buffer: "p w 0\r0\r"
CommandStrings.u32Length = 6
CapturedAccessor is an array of 5 elements

after processing it, i32ResCode is equal to 7.
Can anyone explain me how? How it could read 7 charachters with a length of 6? And whats more how it could find any match?

Michał

EDIT:
there is a bug in READ_ACCESS printed above, because of special charachetr "?"
it should look like that:
[0-9 ]
(r(ead)?)
[ \r]
of course without those enters at the end of line

Comments

Sign In or Register to comment.