We've got such regexp:
var regexp = /^one (two)+ three/;
So only string like "one two three"
or "one two three four"
or "one twotwo three"
etc. will match it.
However, if we've got string like
"one "
- is still 'promising' that maybe soon it will match
but this string:
"one three"
will never match no matter what we'll do.
Is there some way to check if given string have chances to become matching or not?
I need it for some tips during writing when I want to recommend all options that begins with given input (regexp's I'm using are pretty long and I dont want really to mess with them).
In other words - I want to check if string has ended during checking and nothing 'not matching' was faced.
In even more other words - Answer would be inside reason of not matching. If reason is end of string - then it would be promissing. However I dont know any way to check why some string didnt match
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…