[issue25200] bug on re.search using the char ,-:

Serhiy Storchaka report at bugs.python.org
Mon Sep 21 06:25:28 CEST 2015


Serhiy Storchaka added the comment:

This is how regular expressions work.

https://docs.python.org/3/library/re.html#regular-expression-syntax
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 '-'.

----------
nosy: +serhiy.storchaka
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25200>
_______________________________________


More information about the Python-bugs-list mailing list