Skip to content

Instantly share code, notes, and snippets.

@etiennemarais
Created April 11, 2016 13:49
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save etiennemarais/2597e33168a07a16a5d541db2a991005 to your computer and use it in GitHub Desktop.
Save etiennemarais/2597e33168a07a16a5d541db2a991005 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