mentions-regex
100% twitter compatible `@mentions` regex! Regular expression for matching `@username` mentions, as used on twitter, facebook, github, etc.
Last updated 5 years ago by tunnckocore .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install mentions-regex 
SYNC missed versions from official npm registry.

npm version standard style build status coveralls img deps status

100% twitter compatible @mentions regex! Regular expression for matching @username mentions, as used on twitter, facebook, github, etc.

Install

npm i --save mentions-regex
npm test

mentionsRegex

Compatible twitter mentions regex, not only of course!

  • [dot] {Boolean} if true it will allow to match dots
  • return {RegExp}

Usage

For more use-cases see tests

var mentionsRegex = require('mentions-regex');

mentionsRegex().test('foo @bar baz');
//=> true

mentionsRegex().exec('foo @bar baz')[1];
//=> 'bar'

mentionsRegex().test('foo email@bar.com baz');
//=> false

mentionsRegex(true).test('foo email@bar.com baz');
//=> false

mentionsRegex(true).test('foo @bar.com baz');
//=> true

mentionsRegex(true).exec('foo @bar.com baz')[1];
//=> 'bar.com'

Related

  • abbrev-kindof: kind-of with single letter abbreviations to javascript native types, like kindof(val, 'soa') will return true if val is string, object or array.
  • copyright-regex: Regex for matching and parsing copyright statements.
  • dirname-regex: Regular expression for matching the directory part of a file path.
  • glob-path-regex: Regular expression for matching the parts of glob pattern.
  • regexify: Regex everything!

Author

Charlike Mike Reagent

License MIT license

Copyright (c) 2014-2015 Charlike Mike Reagent, contributors.
Released under the MIT license.


Proudly generated by docks(1) on May 4, 2015

Current Tags

  • 2.0.3                                ...           latest (5 years ago)

7 Versions

  • 2.0.3                                ...           5 years ago
  • 2.0.2                                ...           5 years ago
  • 2.0.1                                ...           5 years ago
  • 2.0.0                                ...           5 years ago
  • 1.0.1                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 14
This Month 15
Last Day 14
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (3)

Copyright 2014 - 2017 © taobao.org |