We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Generate a test suite:
// Enhanced usage of RegEx let parser = (input, match) => { for (let pos = 0, lastPos = input.length; pos < lastPos; ) { for (let i = 0; i < match.length; i++) { match[i].pattern.lastIndex = pos let found if ((found = match[i].pattern.exec(input)) !== null) { match[i].action(found) pos = match[i].pattern.lastIndex break } } } } let report = (match) => { console.log(JSON.stringify(match)) } parser("Foo 1 Bar 7 Baz 42", [ { pattern: /Foo\s+(\d+)/y, action: (match) => report(match) }, { pattern: /Bar\s+(\d+)/y, action: (match) => report(match) }, { pattern: /Baz\s+(\d+)/y, action: (match) => report(match) }, { pattern: /\s*/y, action: (match) => {} } ])
More info: http://es6-features.org/#RegularExpressionStickyMatching
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Generate a test suite:
More info: http://es6-features.org/#RegularExpressionStickyMatching
The text was updated successfully, but these errors were encountered: