<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>should have escaped hyphen as it could be used for ranging. <br><br>sorry for the bother...<br><br><div><hr id="stopSpelling">From: ycui@outlook.com<br>To: python-list@python.org<br>Subject: Regular Expression : Bad Character Range<br>Date: Thu, 19 Dec 2013 23:50:52 -0300<br><br>

<style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}

.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:Calibri;
}

--></style>
<div dir="ltr">Hey guys,<br><br>I'm trying to compile a regular Expression while encountering the following issue, any hints ?<br><br>is hyphen "-" or underscore "_" considered any meta character which is not allowed when putting into the range ?<br><br>Thanks<br>Frank<br><br>In [2]: re.compile("[\w-_]+>")<br>---------------------------------------------------------------------------<br>error                                     Traceback (most recent call last)<br>/home/frank/<ipython-input-2-ee4b44c4d17a> in <module>()<br>----> 1 re.compile("[\w-_]+>")<br><br>/usr/lib/python2.7/re.pyc in compile(pattern, flags)<br>    188 def compile(pattern, flags=0):<br>    189     "Compile a regular expression pattern, returning a pattern object."<br>--> 190     return _compile(pattern, flags)<br>    191 <br>    192 def purge():<br><br>/usr/lib/python2.7/re.pyc in _compile(*key)<br>    240         p = sre_compile.compile(pattern, flags)<br>    241     except error, v:<br>--> 242         raise error, v # invalid expression<br>    243     if len(_cache) >= _MAXCACHE:<br>    244         _cache.clear()<br><br>error: bad character range<br><br>                                    </div>
<br>-- 
https://mail.python.org/mailman/listinfo/python-list</div>                                          </div></body>
</html>