Tim Peters added the comment:
Do note that `.match()` is constrained to match starting at the first byte.
`.search()` is not (it can start matching at any position), and your example
works fine if `.search()` is used instead.
This is all expected, and intended, and documented.
--
nos
Serhiy Storchaka added the comment:
There is no bug.
The pattern b'a' matches bytes that starts with byte 97 (ord(b'a')), but
b'\x00abc' starts with byte 0.
--
nosy: +serhiy.storchaka
resolution: -> not a bug
stage: -> resolved
status: open -> closed
New submission from Simmo Saan:
Regex functions on bytes consider zero byte as end and stop matching at that
point. This is completely nonsensical since python has no problems working with
zero bytes otherwise.
For example:
Matches as expected: re.match(b'a', b'abc')
Does not match unexpec