Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #62424

Regular Expression : Bad Character Range

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin1!goblin2!goblin.stu.neva.ru!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ycui@outlook.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.037
X-Spam-Evidence '*H*': 0.93; '*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; 'putting': 0.22; 'to:name :python-list@python.org': 0.22; 'error': 0.23; 'issue,': 0.24; 'subject: : ': 0.26; 'character': 0.29; 'raise': 0.29; "i'm": 0.30; 'regular': 0.32; '(most': 0.33; 'skip:_ 10': 0.34; 'except': 0.35; 'returning': 0.36; 'thanks': 0.36; '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; 'bad': 0.39; 'to:addr:python.org': 0.39; 'expression': 0.60; 'range': 0.61; 'frank': 0.68; 'hints': 0.68; 'invalid': 0.68; '241': 0.84; 'received:65.54.190.29': 0.91; 'received:bay0-omc1-s18.bay0.hotmail.com': 0.91
X-TMN [qwXpj4Q3lC6WLgwLrfWeI8CuvdfNXdaB]
X-Originating-Email [ycui@outlook.com]
Content-Type multipart/alternative; boundary="_35ef45d1-4402-4cd6-9a12-107d7d873bcc_"
From Frank Cui <ycui@outlook.com>
To "python-list@python.org" <python-list@python.org>
Subject Regular Expression : Bad Character Range
Date Thu, 19 Dec 2013 23:50:52 -0300
Importance Normal
MIME-Version 1.0
X-OriginalArrivalTime 20 Dec 2013 03:20:53.0441 (UTC) FILETIME=[7D66E310: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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4424.1387509722.18130.python-list@python.org> (permalink)
Lines 88
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1387509722 news.xs4all.nl 2880 [2001:888:2000:d::a6]:50580
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:62424

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

Hey guys,

I'm trying to compile a regular Expression while encountering the following issue, 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/<ipython-input-2-ee4b44c4d17a> in <module>()
----> 1 re.compile("[\w-_]+>")

/usr/lib/python2.7/re.pyc in compile(pattern, flags)
    188 def compile(pattern, flags=0):
    189     "Compile a regular expression pattern, returning a pattern object."
--> 190     return _compile(pattern, flags)
    191 
    192 def purge():

/usr/lib/python2.7/re.pyc in _compile(*key)
    240         p = sre_compile.compile(pattern, flags)
    241     except error, v:
--> 242         raise error, v # invalid expression
    243     if len(_cache) >= _MAXCACHE:
    244         _cache.clear()

error: bad character range

 		 	   		  

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Regular Expression : Bad Character Range Frank Cui <ycui@outlook.com> - 2013-12-19 23:50 -0300

csiph-web