Closed
Description
This is similar and related to #3178
As per the above issue
>>> import ure
>>> print( ure.search(r"[a\-z]", "-") )
None
>>> print( ure.search(r"[a\-z]", "f") )
<match num=1>
escaping '-' inside character classes doesn't work, it still treats it as a range specifier. There is the workaround for that issue though by putting -
at the start/end of the character class.
Similarly though, escaping ]
also doesn't work, it appears to close the character class, but then there's the extra ]
later on so you end up with an invalid regex.
>>> import ure
>>> print( ure.search(r"[a\]z]", "a") )
None
I don't think there's any way to make a character class that matches ']` at all.