Message326716
I was writing the following:
re.search('([+-*])', "54 * 83")
And I got the following runtime error:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Users\bnaya\AppData\Local\Programs\Python\Python37-32\lib\re.py", line 183, in search
return _compile(pattern, flags).search(string)
File "C:\Users\bnaya\AppData\Local\Programs\Python\Python37-32\lib\re.py", line 286, in _compile
p = sre_compile.compile(pattern, flags)
File "C:\Users\bnaya\AppData\Local\Programs\Python\Python37-32\lib\sre_compile.py", line 764, in compile
p = sre_parse.parse(p, flags)
File "C:\Users\bnaya\AppData\Local\Programs\Python\Python37-32\lib\sre_parse.py", line 930, in parse
p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0)
File "C:\Users\bnaya\AppData\Local\Programs\Python\Python37-32\lib\sre_parse.py", line 426, in _parse_sub
not nested and not items))
File "C:\Users\bnaya\AppData\Local\Programs\Python\Python37-32\lib\sre_parse.py", line 816, in _parse
p = _parse_sub(source, state, sub_verbose, nested + 1)
File "C:\Users\bnaya\AppData\Local\Programs\Python\Python37-32\lib\sre_parse.py", line 426, in _parse_sub
not nested and not items))
File "C:\Users\bnaya\AppData\Local\Programs\Python\Python37-32\lib\sre_parse.py", line 580, in _parse
raise source.error(msg, len(this) + 1 + len(that))
re.error: bad character range +-* at position 2
Note that for different operators order, such as:
re.search('([+*-])', "54 * 83")
or
re.search('([*+-])', "54 * 83")
the function worked just fine. |
|
Date |
User |
Action |
Args |
2018-09-30 08:37:44 | Bnaya | set | recipients:
+ Bnaya, ezio.melotti, mrabarnett |
2018-09-30 08:37:44 | Bnaya | set | messageid: <1538296664.11.0.545547206417.issue34851@psf.upfronthosting.co.za> |
2018-09-30 08:37:44 | Bnaya | link | issue34851 messages |
2018-09-30 08:37:43 | Bnaya | create | |
|