nurulc / incr-regex-package

A node package for incremental regular expression parsing in JavaScript; useful for input validation
ISC License
13 stars 1 forks source link

FAIL never reached #5

Open EladProject opened 4 years ago

EladProject commented 4 years ago

Hello,

I find your package, potentially useful, however, I can't get some basic functionality to work (or I misunderstand how it works). I'm trying to run the following query, expecting to receive FAIL, but I'm getting MORE:

rx = ir.incrRegEx("\\d{3}-\\d{3}-\\d{4}"); rx.matchStr("lala123"); rx.state();

Is this the expected behavior?

gschadow commented 2 years ago

This seems to be related with my issue. incrRegEx seems to have problems with the start symbol. If you start your regex with ^ nothing will ever match. But if you start it without ^ it will do a seek to the first match I guess.