nitely / nim-regex

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

Failed parse regular expression #98

Closed artemklevtsov closed 3 years ago

artemklevtsov commented 3 years ago

I faced with error on some regexes.

Minimal example:

import re
import regex

let s = r"(\d+)\.(\d+)(\.(\d+)|)(\.(\d+)|)"
let rx1 = re.re(s)
let rx2 = regex.re(s)

Output:

nim compile --verbosity:0 --hints:off --run "/home/unikum/Projects/Nim/nim-uap/test.nim" 
/home/unikum/Projects/Nim/test.nim(6) test
/home/unikum/.nimble/pkgs/regex-0.19.0/regex.nim(283) re
/home/unikum/.nimble/pkgs/regex-0.19.0/regex/compiler.nim(15) reImpl
/home/unikum/.nimble/pkgs/regex-0.19.0/regex/nfa.nim(316) nfa2
/home/unikum/.nimble/pkgs/regex-0.19.0/regex/nfa.nim(77) eNfa
/usr/lib/nim/system.nim(1837) pop
/usr/lib/nim/system/fatal.nim(49) sysFatal
Error: unhandled exception: index out of bounds, the container is empty [IndexDefect]
Error: execution of an external program failed: '/home/unikum/Projects/Nim/test '
artemklevtsov commented 3 years ago

Thank you for the quick fix.