Copyright ©

Mongoose OS Forum


slre regex miss match

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


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


Sign In or Register to comment.