Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #62425 > unrolled thread
| Started by | Frank Cui <ycui@outlook.com> |
|---|---|
| First post | 2013-12-19 23:53 -0300 |
| Last post | 2013-12-19 23:53 -0300 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
RE: Regular Expression : Bad Character Range Frank Cui <ycui@outlook.com> - 2013-12-19 23:53 -0300
| From | Frank Cui <ycui@outlook.com> |
|---|---|
| Date | 2013-12-19 23:53 -0300 |
| Subject | RE: Regular Expression : Bad Character Range |
| Message-ID | <mailman.4425.1387509854.18130.python-list@python.org> |
[Multipart message — attachments visible in raw view] — view raw
should have escaped hyphen as it could be used for ranging.
sorry for the bother...
From: ycui@outlook.com
To: python-list@python.org
Subject: Regular Expression : Bad Character Range
Date: Thu, 19 Dec 2013 23:50:52 -0300
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
--
https://mail.python.org/mailman/listinfo/python-list
Back to top | Article view | comp.lang.python
csiph-web