Text Processingflags: g
JavaScript Template Literal Placeholder
Match `${expression}` placeholders inside JavaScript template literals.
Try it in RegexPro →Available in
Pattern
regexengine-agnostic
\$\{([^{}]+)\} (flags: g)Raw source: \$\{([^{}]+)\}
How it works
\$ matches the dollar sign. \{ matches the opening brace. ([^{}]+) captures one or more non-brace characters as the inner expression. \} matches the closing brace. The pattern won't handle nested braces (e.g. `${ {a:1}.a }`); for that you need a real parser, but this regex covers the common case.
Examples
Input
`Hello ${name}, you have ${count} items`Matches
${name}${count}
Input
const url = `https://api.com/${endpoint}?key=${apiKey}`Matches
${endpoint}${apiKey}
Input
no placeholdersNo match
—Common use cases
- •Static analysis of template-literal usage
- •Tagged template processors and i18n tooling
- •Linters that detect unsanitized expressions in HTML templates
- •Build-time string interpolation tooling
Related patterns
Python f-String Expression
Text ProcessingMatch `{expression}` placeholders inside Python f-strings (or any single-brace template syntax).
JavaScript Variable Declaration
Text ProcessingMatch JavaScript / TypeScript variable declarations (`var`, `let`, `const`), capturing the keyword and identifier name.
JSON Boolean / Null Literal
Text ProcessingMatch JSON `true`, `false`, and `null` literal values, with word boundaries to avoid partial matches.
Emoji (Unicode)
Text ProcessingMatch emoji characters across the main Unicode emoji ranges — requires the Unicode flag in JavaScript.