Skip to content

Error parse template error when script has regex in templ "template closing brace not found" #1243

@minhluan2292

Description

@minhluan2292

Templ parse err when script has regex:

const clientIdMatch = evt.detail.message.match(/data-client-id="([^"]+)"/);
Error: parsing error: template closing brace not found

but write regex twice will no error:

const regex = /data-client-id="([^"]+)"/;
const clientIdMatch = evt.detail.message.match(/data-client-id="([^"]+)"/);

Try this also error as above:

const regex = /data-client-id="([^"]+)"/;
const clientIdMatch = evt.detail.message.match(regex);

Environment:

  • Go: go version go1.23.3
  • templ: v0.3.920

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions