Skip to content

compiler: interpolation ends early when a regular expression literal contains }} #71915

Closed as duplicate

Description

@nagahara-naoki

Bug

Hi Angular team! Angular treats }} inside a regular expression literal as the end of an interpolation.

Minimal reproduction

{{ /[}}]/u.test('}') }}

Expected true. Actual Unexpected closing block. The same expression fails in a title interpolation with Unterminated regular expression but parses successfully in a property binding. The equivalent pattern /[}]/u also parses in interpolation. AOT compilation with ngc reports NG5002 for {{ /}}/.test('}}') }}.

Cause and possible fix

The scanners appear to treat }} inside the regex as a closing delimiter. A possible fix is to skip regex literal contents while preserving division expressions such as {{ 6 / 2 }}. HTML lexer · Expression parser

Environment

Angular compiler 22.2.5, Node.js 24.22.2, macOS arm64. Regression status unknown.

Activity

  1. added this to the needsTriage milestone on Nov 10, 2026
  2. crisbeto commented on Nov 10, 2026

    @crisbeto
    Member

    I suspect this is the same root cause as #9571.

  3. atscott commented on Nov 10, 2026

    @atscott
    Contributor

    #9571 already tracks the two-phase interpolation-boundary limitation.

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

    area: compilerIssues related to `ngc`, Angular's template compiler

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions