Hi folks,
I'm having trouble with some ure regex stuff. Specifically, escaping metacharacters.
This code works as expected - [ within [] is read as a literal.
>>> ure.search(r"[[]", "[")
<match num=2>
However, the following statements don't work (have tried multiple \ characters too):
>>> ure.search(r"[]]", "]")
>>> ure.search(r"[\]]", "]")
I've tried the following successfully using python 3 and re:
>>> re.search(r"[[]", "[")
<_sre.SRE_Match object; span=(0, 1), match='['>
>>> re.search(r"[\]]", "]")
<_sre.SRE_Match object; span=(0, 1), match=']'>
Ultimately, I want to use the following regex pattern (https://github.com/kanaka/mal/blob/mast ... -and-print), but I think I'm a way off yet:
[\s,]*(~@|[\[\]{}()'`~^@]|"(?:\\.|[^\\"])*"|;.*|[^\s\[\]{}('"`,;)]*)
Is this a limitation of ure, a bug, or am I simply just doing it wrong (very likely)?
Cheers in advance