We were recording the start of the scanset before checking if it began
with a caret. We need to check for a caret first, then record whatever
comes next as the start of the scanset.
Note that scanf() did not have this bug, only wscanf(), but this adds
regression tests for both anyway.
MFC after: 1 week