1.0.0 • Published 3 years ago

hashtag-regex-plus v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

hashtag-regex-plus

Based on the fantastic hashtag-regex by mathiasbynens. This fork contains my attempts to enhance the module by providing some options to it.

Installation

Via npm:

npm install https://github.com/tahara-san/hashtag-regex-plus.git

In Node.js:

const hashtagRegex = require('hashtag-regex-plus');
const regex = hashtagRegex({});
const isMatched = regex.test('#text');

Options:

const regex = hashtagRegex({ stripHash: false, forceEnd: false, forceStart: false});
/*
  stripHash: just look for hashtag body chars with excluding hash symbols.
  forceStart: a hashtag must be in the beginning of a string ( this option adds /^/ to the regex );
  forceEnd: a hashtag must be in the end of a string ( this option adds /$/ to the regex)
 */

License

hashtag-regex-plus is available under the MIT license.