[issue11204] re module: strange behaviour of space inside {m, n}

2014-09-14 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
resolution:  - rejected
stage:  - resolved
status: pending - closed

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



[issue11204] re module: strange behaviour of space inside {m, n}

2013-10-27 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
status: open - pending

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



[issue11204] re module: strange behaviour of space inside {m, n}

2013-02-11 Thread Roy Smith

Changes by Roy Smith r...@panix.com:


--
nosy: +roysmith

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11204
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11204] re module: strange behaviour of space inside {m, n}

2013-01-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Then let's leave all as is.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11204
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11204] re module: strange behaviour of space inside {m, n}

2012-12-02 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
components: +Library (Lib), Regular Expressions
nosy: +mrabarnett
type:  - behavior
versions: +Python 3.2, Python 3.3, Python 3.4 -Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11204
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11204] re module: strange behaviour of space inside {m, n}

2012-12-02 Thread Matthew Barnett

Matthew Barnett added the comment:

Interesting.

In my regex module (http://pypi.python.org/pypi/regex) I have:

bool(regex.match(pat, bb, regex.VERBOSE)) # True
bool(regex.match(pat, b{1,3}, regex.VERBOSE)) # False

because I thought that when the VERBOSE flag is turned on it should ignore 
whitespace except when it's inside a character class, so b{1, 3} would be 
treated as b{1,3}.

Apparently re has another exception.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11204
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11204] re module: strange behaviour of space inside {m, n}

2012-12-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

$ echo 'baaa' | grep -o 'b\{1,3\}a'
bbba
$ echo 'baaa' | grep -o 'b\{1, 3\}a'
grep: Invalid content of \{\}
$ echo 'baaa' | egrep -o 'b{1,3}a'
bbba
$ echo 'baaa' | egrep -o 'b{1, 3}a'
$ echo 'bbb{1, 3}aa' | LC_ALL=C egrep -o 'b{1, 3}a'
b{1, 3}a

I.e. grep raises error and egrep chooses silent verbatim meaning. I don't know 
what any standards say about this.

--
nosy: +serhiy.storchaka

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11204
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11204] re module: strange behaviour of space inside {m, n}

2012-12-02 Thread Matthew Barnett

Matthew Barnett added the comment:

The question is whether re should always treat 'b{1, 3}a' as a literal, even 
with the VERBOSE flag.

I've checked with Perl 5.14.2, and it agrees with re: adding a space _always_ 
makes it a literal, even with the 'x' flag (/b{1, 3}a/x is treated as 
/b\{1,3}a/).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11204
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11204] re module: strange behaviour of space inside {m, n}

2011-02-18 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
nosy: +ezio.melotti, pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11204
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11204] re module: strange behaviour of space inside {m, n}

2011-02-12 Thread John Machin

New submission from John Machin sjmac...@lexicon.net:

A pattern like rb{1,3}\Z matches b, bb, and bbb, as expected. There is 
no documentation of the behaviour of rb{1, 3}\Z -- it matches the LITERAL 
TEXT b{1, 3} in normal mode and b{1,3} in verbose mode.

# paste the following at the interactive prompt:
pat = rb{1, 3}\Z
bool(re.match(pat, bb)) # False
bool(re.match(pat, b{1, 3})) # True
bool(re.match(pat, bb, re.VERBOSE)) # False
bool(re.match(pat, b{1, 3}, re.VERBOSE)) # False
bool(re.match(pat, b{1,3}, re.VERBOSE)) # True

Suggested change, in decreasing order of preference:
(1) Ignore leading/trailing spaces when parsing the m and n components of {m,n}
(2) Raise an exception if the exact syntax is not followed
(3) Document the existing behaviour

Note: deliberately matching the literal text would be expected to be done by 
escaping the left brace:

pat2 = rb\{1, 3}\Z
bool(re.match(pat2, b{1, 3})) # True

and this is not prevented by the suggested changes.

--
messages: 128472
nosy: sjmachin
priority: normal
severity: normal
status: open
title: re module: strange behaviour of space inside {m, n}
versions: Python 2.7, Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11204
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com