Skip to content

v3.8.10

Latest

Choose a tag to compare

@github-actions github-actions released this 24 Nov 00:53
fc06d89
fix: allow more than one regex in a query (#60)

A query may hold only one regex. Two are reported as ambiguous, and where only
one reading parses, a regex silently swallows the rest of the query instead:

    parse('name:/foo/ name:/bar/')  // LiqeError: Ambiguous results.
    parse('name:/foo/ bar/')        // one regex, body "foo/ bar"

`regex_body_char` accepts any character but a backslash, so a forward slash can
sit inside a body as well as close it. Both readings of a query holding two
slashes are valid, which the parser reports as ambiguous, or accepts as the
wrong one where the other does not parse.

A body now ends at the first unescaped slash, as in JavaScript, where a literal
slash is written `\\/`. A character class is read as a unit, so `/[/]/` keeps
working unescaped. Escapes are unaffected: `\\/` and `\\\\` are matched by the
rules added in #50.

The only form that changes meaning is an unescaped slash inside a body, as in
`/a/b/`. It is undocumented, untested, and invalid in JavaScript, where it reads
as the regex `/a/` followed by the flag `b`.