Program: import re echo escapeRe("[Одиноков]") echo escapeRe("[Oklahoma]") Run
Produces: \x5B\xD0\x9E\xD0\xB4\xD0\xB8\xD0\xBD\xD0\xBE\xD0\xBA\xD0\xBE\xD0\xB2\x5D \x5BOklahoma\x5D Run The Oklahoma is right, but not the Greek word. Really I need regex meta characters to be escaped and everything else untouched. Looking at the source it encodes everything except: 'a'..'z', 'A'..'Z', '0'..'9', '_': <https://github.com/nim-lang/Nim/blob/version-1-4/lib/impure/re.nim#L531> Is there such a function or should I make one? What is the reason for escapeRe encoding so broadly?