JSPM

hash-regex

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q32370F
  • License MIT

Converts an array of strings to a regular expression of hashtags

Package Exports

  • hash-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 (hash-regex) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

hash-regex Build Status

Converts an array of strings to a regular expression of hashtags

Install

$ npm install --save hash-regex

Usage

const hashRegEx = require('hash-regex');

const regEx1 = hashRegEx(['one','two','three']);
//=> /#one|#two|#three/gi

// strings can have a hash sign, or not. Override the default flags
const regEx2 = hashRegEx(['#withhash','withouthash'], {flags:'m'});
//=> /#withhash|#withouthash/m

API

hashRegEx(array,[options])

array

Type: Array
Required

The array of strings you want to convert to a RegExp of hashes. Strings can begin with hash or not.

options

flags

Type: String
Default: gi

The RegExp flags you want to use.

License

MIT © Michael Wuergler