nitely / nim-regex

Pure Nim regex engine. Guarantees linear time matching
https://nitely.github.io/nim-regex/
MIT License
227 stars 20 forks source link

`$1` incorrectly accepted when it doesn't refer to a capture #25

Open timotheecour opened 5 years ago

timotheecour commented 5 years ago
import pkg/regex

when defined(case2):
  # BUG: abc$2def instead of error as in case3b (should use "$$2" if that's what user wants)
  echo "abcfoodef".replace(re"foo", "$2")

when defined(case3b):
  # OK: RT error: invalidFormatString
  echo "abcfoodef".replace(re"f(o)o", "[$2]")