Skip to content

Commit

Permalink
fix: capture groups for each statements
Browse files Browse the repository at this point in the history
improve capture group regex for `each` statements using a greedy match.

fixes pugjs#3263
  • Loading branch information
error418 committed Jul 3, 2020
1 parent 06baa52 commit fe4220f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/pug-lexer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ Lexer.prototype = {

eachOf: function() {
var captures;
if ((captures = /^(?:each|for) (.*) of *([^\n]+)/.exec(this.input))) {
if ((captures = /^(?:each|for) (.*?) of *([^\n]+)/.exec(this.input))) {
this.consume(captures[0].length);
var tok = this.tok('eachOf', captures[1]);
tok.value = captures[1];
Expand Down

0 comments on commit fe4220f

Please sign in to comment.