镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

ECMAScript: compile and match the empty pattern #11

Closed

Description

@chrisbbreuer

zig-js issue zig-utils/zig-js#213 needs JavaScriptCore-compatible empty regular expressions.

ECMAScript treats an empty pattern as a valid zero-width regex, but Regex.compileWithFlags currently returns RegexError.EmptyPattern before the parser can build its existing empty AST node.

Acceptance criteria:

  • Empty patterns compile successfully.
  • find and findFrom return a zero-width match at the requested valid position.
  • Iteration/search callers can advance after zero-width matches without an engine loop.
  • Existing non-empty behavior remains covered.
  • README/API documentation no longer claims empty patterns are rejected.

Activity

  1. chrisbbreuer commented on Jul 17, 2026

    @chrisbbreuer
    MemberAuthor

    Implemented and pushed to main in fd4927c. Empty ECMAScript patterns now compile and produce zero-width matches at the start, requested findFrom position, and end of input. Focused regression: zig test src/regex.zig --test-filter "compile empty pattern" (1/1 passed). zig-utils/zig-js#213 will consume this directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions