Skip to content

Commit

Permalink
fix for non-global regular expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
dmotz committed Sep 3, 2016
1 parent d2a7514 commit 0a7c058
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion index.js
Expand Up @@ -44,6 +44,9 @@ StreamSnitch.prototype._write = function(chunk, encoding, cb) {
while (match = this.regex.exec(this._buffer)) {
this.emit('match', match);
lastMatch = match;
if (!this.regex.global) {
break;
}
}

if (lastMatch) {
Expand All @@ -63,4 +66,3 @@ StreamSnitch.prototype.clearBuffer = function() {
this._buffer = '';
return this;
}

0 comments on commit 0a7c058

Please sign in to comment.