Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

re-use of tester results in incorrect output #63

Closed
wwwouter opened this issue Sep 2, 2013 · 1 comment
Closed

re-use of tester results in incorrect output #63

wwwouter opened this issue Sep 2, 2013 · 1 comment

Comments

@wwwouter
Copy link

wwwouter commented Sep 2, 2013

verbalExpr = require("verbal-expressions")

endOfOutputTester = verbalExpr()
      .startOfLine()
      .then("www")

test1 = "www"
console.log(endOfOutputTester.test(test1))
console.log(endOfOutputTester.test(test1))
console.log(endOfOutputTester.test(test1))
console.log(endOfOutputTester.test(test1))
console.log(endOfOutputTester.test(test1))

the output is

true
false
true
false
true

using version 0.1.0

@mihai-vlc
Copy link
Contributor

I did a bit of research and found that this is not caused by this library it's a bug in the regex engine:

http://blog.stevenlevithan.com/archives/es3-regexes-broken

For your particular example removing the g modifier would fix the problem

var reg = VerEx().startOfLine().then("www").removeModifier("g");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants