Message24118
The {m} matcher seems not to be applicable to (some)
empty matches. For example this will raise a regex
compile error:
>>> re.compile("(a*){4}")
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.3/sre.py", line 179, in compile
return _compile(pattern, flags)
File "/usr/lib/python2.3/sre.py", line 230, in _compile
raise error, v # invalid expression
sre_constants.error: nothing to repeat
However this matcher is compiled without error:
>>> re.compile("(\ba*){4}")
<_sre.SRE_Pattern object at 0xb7f86c58>
I don't know why the first example gives an error, but
it should perhaps be mentioned in the documentation
about the {} regex operator. |
|
| Date |
User |
Action |
Args |
| 2007-08-23 14:29:16 | admin | link | issue1113484 messages |
| 2007-08-23 14:29:16 | admin | create | |
|