[issue19408] Regex with set of characters and groups raises error

2013-10-26 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue19408] Regex with set of characters and groups raises error

2013-10-26 Thread Matthew Barnett

Matthew Barnett added the comment:

The traceback says "bad character range" because ord('+') == 43 and ord('*') == 
42. It's not surprising that it complains if the range isn't valid.

--

___
Python tracker 

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



[issue19408] Regex with set of characters and groups raises error

2013-10-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

>From re documentation:

"""Ranges of characters can be indicated by giving two characters and 
separating them by a '-', for example [a-z] will match any lowercase ASCII 
letter, [0-5][0-9] will match all the two-digits numbers from 00 to 59, and 
[0-9A-Fa-f] will match any hexadecimal digit. If - is escaped (e.g. [a\-z]) or 
if it’s placed as the first or last character (e.g. [a-]), it will match a 
literal '-'."""

A Python exception is not a crash. A crash is a Segmentation Fault (*nix) or 
'Your program stopped unexpectedly' (Windows).

--
nosy: +serhiy.storchaka
resolution:  -> invalid
type: crash -> 

___
Python tracker 

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



[issue19408] Regex with set of characters and groups raises error

2013-10-26 Thread Isis Binder

New submission from Isis Binder:

I was working on some SPOJ exercises when the regex module hit me with an error 
related to '*' being used inside the character set operator.

I looked in the module docs but it says: Special characters lose their special 
meaning inside sets. For example, [(+*)] will match any of the literal 
characters '(', '+', '*', or ')'.

Traceback attached.

Offending code (inside IDLE):
import re
a = '73479*5152'
re.match(r'(\d+)([+-*])(\d+)', a).groups()

NOTE: if I write r'(\d+)([*])(\d+)', r'(\d+)([*+-])(\d+)' or 
r'(\d+)([+*-])(\d+)' it works. Shouldn't it simply work as described in the 
docs or should the docs be updated with an entry about proper character 
ordering in the character class?

--
components: Regular Expressions
files: traceback.txt
messages: 201351
nosy: Isis.Binder, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: Regex with set of characters and groups raises error
type: crash
versions: Python 3.3
Added file: http://bugs.python.org/file32372/traceback.txt

___
Python tracker 

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