Skip to Content
  • Website
Codsen
  • Home
  • Open Source
  • Articles
  • About

prevOpen Source→regex-is-jinja-nunjucksnext

regex-is-jinja-nunjucks4.2.1

Regular expression for detecting Jinja or Nunjucks code

Downloads per monthChangelogMIT Licenselibera manifesto
  • the top
  • Installation
  • Quick Take
  • Examples
  • API — ISJINJANUNJUC…
  • API — VERSION
  • Changelog

Development is frozen. The published package, documentation, examples, and changelog remain available.

Permalink to InstallationInstallation

Permalink to Quick TakeQuick Take

Permalink to ExamplesExamples

  • Recognise Jinja and Nunjucks delimiter styles
  • Reject HTML without Jinja or Nunjucks delimiters

API — isJinjaNunjucksRegex()

The main function isJinjaNunjucksRegex() is imported like this:

Returns a fresh global RegExp for Jinja/Nunjucks opening markers: {% and {{. Use it with RegExp.prototype.exec() or String.prototype.match(). Closing markers %} and }} are excluded, so nested JSON or CSS closing braces do not count as template evidence.

An opening marker alone is accepted as an incomplete editor fragment. This helper locates syntax hints; it does not validate a complete template. Create a fresh regex for independent .test() calls, or reset lastIndex to zero.

API — version

You can import version:

Permalink to changelogChangelog

Open Changelog
↑ back to top
prev next

Copyright

All rights reserved © Roy Revelt 2026
All our open source packages are under MIT licenceopens in a new tab

Activities

🐛 See a bug? Raise an issueopens in a new tab
💘 Check out the Indiewebopens in a new tab and Libera manifestoopens in a new tab