tinyre
tinyre copied to clipboard
The replace function throws error for unmatched subgroups
If the regex contains subgroups that never matched, then their boundary slice would be from -1 to -1.
My regex: \$(?:(\$)|([_a-z]\w*)|\{([_a-z]\w*)(?:(:?)([-\?])([^\}]*))?\})
Error:
/home/lj/.local/share/nimble/pkgs2/tinyre-1.5.1-60bc507bc3d3fe395c4d6444c0de1880ddcfa893/tinyre.nim(430) replace
/home/lj/.choosenim/toolchains/nim-2.0.0/lib/system/indices.nim(86) []
/home/lj/.choosenim/toolchains/nim-2.0.0/lib/system/fatal.nim(53) sysFatal
Error: unhandled exception: index -1 not in 0 .. 16 [IndexDefect]