Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions libregexp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1633,11 +1633,13 @@ static int re_parse_term(REParseState *s, BOOL is_backward_dir)

if (dbuf_error(&s->byte_code))
goto out_of_memory;
add_zero_advance_check = (re_check_advance(s->byte_code.buf + last_atom_start,
s->byte_code.size - last_atom_start) == 0);
} else {
add_zero_advance_check = FALSE;
}
/* the spec tells that if there is no advance when
running the atom after the first quant_min times,
then there is no match. We remove this test when we
are sure the atom always advances the position. */
add_zero_advance_check = (re_check_advance(s->byte_code.buf + last_atom_start,
s->byte_code.size - last_atom_start) == 0);

{
int len, pos;
Expand Down
4 changes: 4 additions & 0 deletions tests/test_builtin.js
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,10 @@ function test_regexp()

eval("/[\\-]/");
eval("/[\\-]/u");

/* test zero length matches */
a = /()*?a/.exec(",");
assert(a, null);
}

function test_symbol()
Expand Down