This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Bnaya
Recipients Bnaya, ezio.melotti, mrabarnett
Date 2018-09-30.08:37:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1538296664.11.0.545547206417.issue34851@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-09-30 08:37:44Bnayasetrecipients: + Bnaya, ezio.melotti, mrabarnett
2018-09-30 08:37:44Bnayasetmessageid: <1538296664.11.0.545547206417.issue34851@psf.upfronthosting.co.za>
2018-09-30 08:37:44Bnayalinkissue34851 messages
2018-09-30 08:37:43Bnayacreate