Home

Awesome

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!

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

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