[issue26895] regex matching on bytes considers zero byte as end

2016-04-30 Thread Tim Peters

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.

--
nosy: +tim.peters

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26895] regex matching on bytes considers zero byte as end

2016-04-30 Thread Serhiy Storchaka

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

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26895] regex matching on bytes considers zero byte as end

2016-04-30 Thread Simmo Saan

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 unexpectedly: re.match(b'a', b'\x00abc')

--
components: Regular Expressions
messages: 264561
nosy: Simmo Saan, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: regex matching on bytes considers zero byte as end
type: behavior
versions: Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com