§ Quick Take

import { strict as assert } from "assert";
import isJSP from "regex-is-jsp";

// detects JSP code
assert.equal(
  isJSP().test(`<div><% out.println("Hi!"); %></div>`),
  true
);

// in case if it's not nunjucks
assert.equal(
  isJSP().test(`<div>tralala</div>`),
  false
);

§ API

isJSP()

In other words, it's a function which returns a RegExp object.

§ Changelog

See it in the monorepo opens in a new tab, on Sourcehut.

§ Licence

MIT opens in a new tab

Copyright © 2010–2020 Roy Revelt and other contributors

Related packages:

📦 detect-templating-language 1.1.1
Detects various templating languages present in string
📦 stristri 2.0.0
Extracts or deletes HTML, CSS, text and/or templating tags from string
📦 regex-is-jinja-nunjucks 1.1.1
Regular expression for detecting Jinja or Nunjucks code
📦 regex-empty-conditional-comments 1.9.1
Regular expression for matching HTML empty conditional comments
📦 regex-jinja-specific 1.0.1
Regular expression for detecting Python-specific Jinja code