JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 62984
  • Score
    100M100P100Q151720F
  • License

Create regex for template delimiters.

Package Exports

  • delimiter-regex

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (delimiter-regex) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

delimiter-regex NPM version

Create regex for template delimiters.

Install with npm

npm i delimiter-regex --save

Usage

var delims = require('delimiter-regex');

Example:

Get a regex for matching front-matter:

delims('---', '---');
//=> /---\s*([\s\S]*?)\s*---/

If no args are passed, es6 delimiter regex is returned:

delims();
//=> /\$\{\s*([\s\S]*?)\s*\}/

Params

  • delimiters {String|Array}: supports array format (delims(['{{', '}}'])) or list (delims('{{', '}}'))
  • options: currently RegExp flags is the only option

Flags example

delims('{{', '}}', {flags: 'gm'});
//=> /\{\{([^}}]*)\}\}/gm

Run tests

npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

License

Copyright (c) 2014-2015 Jon Schlinkert
Released under the MIT license


This file was generated by verb on February 04, 2015.