Skip to content

Instantly share code, notes, and snippets.

@gambitier
Forked from etiennemarais/regex.md
Created September 3, 2022 10:56
Show Gist options
  • Select an option

  • Save gambitier/2de68f417206ab7195bbd47ae7c5c1d2 to your computer and use it in GitHub Desktop.

Select an option

Save gambitier/2de68f417206ab7195bbd47ae7c5c1d2 to your computer and use it in GitHub Desktop.
Regular expression for handlebars variables, includes, if/else blocks and unescaped variables

Regex

{{[{]?(.*?)[}]?}}

Captures the value of the variable name in a handlebars template

{{> components/templates/email/includes/email-tr-spacer }}
{{# deliveryAddress }}
{{^ deliveryAddress }}
{{{ deliveryAddressReadable }}}
{{/ deliveryAddress }}
{{/ contactNumber }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment