Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.042 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'error:': 0.07; '[2]:': 0.09; 'underscore': 0.09; 'def': 0.12; '"-"': 0.16; '"_"': 0.16; '240': 0.16; 'guys,': 0.16; 'last)': 0.16; 'subject:Regular': 0.16; 'hey': 0.18; 'trying': 0.19; 'thu,': 0.19; 'putting': 0.22; 'to:name:python-list@python.org': 0.22; 'error': 0.23; 'issue,': 0.24; 'subject: : ': 0.26; 'header:In-Reply-To:1': 0.27; 'character': 0.29; 'raise': 0.29; 'dec': 0.30; "i'm": 0.30; 'url:mailman': 0.30; 'regular': 0.32; 'url:python': 0.33; '(most': 0.33; 'date:': 0.34; 'skip:_ 10': 0.34; 'could': 0.34; 'except': 0.35; 'returning': 0.36; 'url:listinfo': 0.36; 'thanks': 0.36; 'url:org': 0.36; 'should': 0.36; 'email addr:python.org': 0.37; 'skip:& 10': 0.38; 'to:addr:python-list': 0.38; 'received:65.54': 0.38; 'received:65.54.190': 0.38; 'received:bay0.hotmail.com': 0.38; 'recent': 0.39; 'subject:': 0.39; 'bad': 0.39; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'expression': 0.60; 'range': 0.61; 'email name:python-list': 0.65; 'frank': 0.68; 'hints': 0.68; 'invalid': 0.68; '-0300': 0.84; '241': 0.84; '2013': 0.98 X-TMN: [P6BwqPHK01zH4wzQuXy0Uty8ymsS5uDJ] X-Originating-Email: [ycui@outlook.com] Content-Type: multipart/alternative; boundary="_9ec159a3-67b7-480d-a367-5302fc272aac_" From: Frank Cui To: "python-list@python.org" Subject: RE: Regular Expression : Bad Character Range Date: Thu, 19 Dec 2013 23:53:04 -0300 Importance: Normal In-Reply-To: References: MIME-Version: 1.0 X-OriginalArrivalTime: 20 Dec 2013 03:23:06.0707 (UTC) FILETIME=[CCD5AA30:01CEFD32] X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 122 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1387509854 news.xs4all.nl 2951 [2001:888:2000:d::a6]:53146 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:62425 --_9ec159a3-67b7-480d-a367-5302fc272aac_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable should have escaped hyphen as it could be used for ranging.=20 sorry for the bother... From: ycui@outlook.com To: python-list@python.org Subject: Regular Expression : Bad Character Range Date: Thu=2C 19 Dec 2013 23:50:52 -0300 =0A= =0A= =0A= Hey guys=2C I'm trying to compile a regular Expression while encountering the following= issue=2C any hints ? is hyphen "-" or underscore "_" considered any meta character which is not = allowed when putting into the range ? Thanks Frank In [2]: re.compile("[\w-_]+>") --------------------------------------------------------------------------- error Traceback (most recent call last) /home/frank/ in () ----> 1 re.compile("[\w-_]+>") /usr/lib/python2.7/re.pyc in compile(pattern=2C flags) 188 def compile(pattern=2C flags=3D0): 189 "Compile a regular expression pattern=2C returning a pattern ob= ject." --> 190 return _compile(pattern=2C flags) 191=20 192 def purge(): /usr/lib/python2.7/re.pyc in _compile(*key) 240 p =3D sre_compile.compile(pattern=2C flags) 241 except error=2C v: --> 242 raise error=2C v # invalid expression 243 if len(_cache) >=3D _MAXCACHE: 244 _cache.clear() error: bad character range =0A= -- =0A= https://mail.python.org/mailman/listinfo/python-list = --_9ec159a3-67b7-480d-a367-5302fc272aac_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
should have escaped hyphen as it= could be used for ranging.

sorry for the bother...

From: ycui@outlook.com
To: python-list@python.orgSubject: Regular Expression : Bad Character Range
Date: Thu=2C 19 Dec = 2013 23:50:52 -0300

=0A= =0A= =0A=
Hey guys=2C

I'm trying to compile a regular Express= ion while encountering the following issue=2C any hints ?

is hyphen = "-" or underscore "_" considered any meta character which is not allowed wh= en putting into the range ?

Thanks
Frank

In [2]: re.compil= e("[\w-_]+>=3B")
-----------------------------------------------------= ----------------------
error =3B =3B =3B =3B =3B&nbs= p=3B =3B =3B =3B =3B =3B =3B =3B =3B = =3B =3B =3B =3B =3B =3B =3B =3B =3B =3B=  =3B =3B =3B =3B =3B =3B =3B =3B =3B&nb= sp=3B =3B =3B Traceback (most recent call last)
/home/frank/<= =3Bipython-input-2-ee4b44c4d17a>=3B in <=3Bmodule>=3B()
---->=3B= 1 re.compile("[\w-_]+>=3B")

/usr/lib/python2.7/re.pyc in compile(= pattern=2C flags)
 =3B =3B =3B 188 def compile(pattern=2C fl= ags=3D0):
 =3B =3B =3B 189 =3B =3B =3B =3B "= Compile a regular expression pattern=2C returning a pattern object."
--&= gt=3B 190 =3B =3B =3B =3B return _compile(pattern=2C flags)=
 =3B =3B =3B 191
 =3B =3B =3B 192 def purge= ():

/usr/lib/python2.7/re.pyc in _compile(*key)
 =3B =3B&= nbsp=3B 240 =3B =3B =3B =3B =3B =3B =3B =3B= p =3D sre_compile.compile(pattern=2C flags)
 =3B =3B =3B 24= 1 =3B =3B =3B =3B except error=2C v:
-->=3B 242 = =3B =3B =3B =3B =3B =3B =3B =3B raise error=2C = v # invalid expression
 =3B =3B =3B 243 =3B =3B = =3B =3B if len(_cache) >=3B=3D _MAXCACHE:
 =3B =3B =3B= 244 =3B =3B =3B =3B =3B =3B =3B =3B _cache= .clear()

error: bad character range

=0A=
-- =0A= https://mail.python.org/mailman/listinfo/python-list
= --_9ec159a3-67b7-480d-a367-5302fc272aac_--