I can confirm the error and it seems to be for the reason you guessed. We are including the name in the regex itself.
>>> import re
>>> re.compile("-[TBE134N-2.61]-")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/dougal/.pyenv/versions/3.8.4/lib/python3.8/re.py", line 252, in compile
return _compile(pattern, flags)
File "/home/dougal/.pyenv/versions/3.8.4/lib/python3.8/re.py", line 304, in _compile
p = sre_compile.compile(pattern, flags)
File "/home/dougal/.pyenv/versions/3.8.4/lib/python3.8/sre_compile.py", line 764, in compile
p = sre_parse.parse(p, flags)
File "/home/dougal/.pyenv/versions/3.8.4/lib/python3.8/sre_parse.py", line 948, in parse
p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
File "/home/dougal/.pyenv/versions/3.8.4/lib/python3.8/sre_parse.py", line 443, in _parse_sub
itemsappend(_parse(source, state, verbose, nested + 1,
File "/home/dougal/.pyenv/versions/3.8.4/lib/python3.8/sre_parse.py", line 598, in _parse
raise source.error(msg, len(this) + 1 + len(that))
re.error: bad character range N-2 at position 8
I think we will need to re-work this part of the code to make it safer in situations like this.
I can confirm the error and it seems to be for the reason you guessed. We are including the name in the regex itself.
>>> import re "-[TBE134N- 2.61]-" ) dougal/ .pyenv/ versions/ 3.8.4/lib/ python3. 8/re.py" , line 252, in compile dougal/ .pyenv/ versions/ 3.8.4/lib/ python3. 8/re.py" , line 304, in _compile compile( pattern, flags) dougal/ .pyenv/ versions/ 3.8.4/lib/ python3. 8/sre_compile. py", line 764, in compile dougal/ .pyenv/ versions/ 3.8.4/lib/ python3. 8/sre_parse. py", line 948, in parse dougal/ .pyenv/ versions/ 3.8.4/lib/ python3. 8/sre_parse. py", line 443, in _parse_sub (_parse( source, state, verbose, nested + 1, dougal/ .pyenv/ versions/ 3.8.4/lib/ python3. 8/sre_parse. py", line 598, in _parse
>>> re.compile(
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/
return _compile(pattern, flags)
File "/home/
p = sre_compile.
File "/home/
p = sre_parse.parse(p, flags)
File "/home/
p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
File "/home/
itemsappend
File "/home/
raise source.error(msg, len(this) + 1 + len(that))
re.error: bad character range N-2 at position 8
I think we will need to re-work this part of the code to make it safer in situations like this.