sscanf matching things it shouldn't
Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=3326
Reported by BW, Riverweb hww3@riverweb.com
> Pike v7.3 release 62 running Hilfe v3.5 (Incremental Pike Frontend)
>
>>sscanf("1b", "%[0-9]%[0-9]", mixed s, mixed t);
>
> (1) Result: 2
>
Per Martin Nilsson...
Your first %[0-9] will always match all digits so that there will never be any left for the second %[0-9]. But with other values, it is obvious that this is in fact a bug:
> array_sscanf("1", "%[0-9]%[a-c]");
(11) Result: ({ /* 2 elements */
"1",
""
})
> sscanf("12b", "%1[0-9]%[0-9]", s,t);
(12) Result: 2
> s;
(13) Result: "12"
> t;
(14) Result: ""