File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change 1010/**
1111 * Compatible twitter mentions regex, not only of course!
1212 *
13+ * @name mentionsRegex
1314 * @param {Boolean } `dot` if `true` it will allow to match dots
1415 * @return {RegExp }
1516 * @api public
1617 */
17- module . exports = function metntionsRegex ( dot ) {
18+ module . exports = function mentionsRegex ( dot ) {
1819 if ( dot ) {
1920 // e.g. @google .com will match `google.com`
2021 return / (?: ^ | [ ^ a - z A - Z 0 - 9 _ @ ! @ # $ % & * ] ) (?: (?: @ | @ ) (? ! \/ ) ) ( [ a - z A - Z 0 - 9 / _ . ] { 1 , 15 } ) (?: \b (? ! @ | @ ) | $ ) / ;
Original file line number Diff line number Diff line change 99```
1010
1111
12- ## [ metntionsRegex ] ( index.js#L17 )
12+ ## [ mentionsRegex ] ( index.js#L18 )
1313> Compatible twitter mentions regex, not only of course!
1414
1515* ` [dot] ` ** {Boolean}** if ` true ` it will allow to match dots
@@ -20,24 +20,24 @@ npm test
2020> For more use-cases see [ tests] ( ./test.js )
2121
2222``` js
23- var metntionsRegex = require (' metntions -regex' );
23+ var mentionsRegex = require (' mentions -regex' );
2424
25- metntionsRegex ().test (' foo @bar baz' );
25+ mentionsRegex ().test (' foo @bar baz' );
2626// => true
2727
28- metntionsRegex ().exec (' foo @bar baz' )[1 ];
28+ mentionsRegex ().exec (' foo @bar baz' )[1 ];
2929// => 'bar'
3030
31- metntionsRegex ().test (' foo email@bar.com baz' );
31+ mentionsRegex ().test (' foo email@bar.com baz' );
3232// => false
3333
34- metntionsRegex (true ).test (' foo email@bar.com baz' );
34+ mentionsRegex (true ).test (' foo email@bar.com baz' );
3535// => false
3636
37- metntionsRegex (true ).test (' foo @bar.com baz' );
37+ mentionsRegex (true ).test (' foo @bar.com baz' );
3838// => true
3939
40- metntionsRegex (true ).exec (' foo @bar.com baz' )[1 ];
40+ mentionsRegex (true ).exec (' foo @bar.com baz' )[1 ];
4141// => 'bar.com'
4242```
4343
You can’t perform that action at this time.
0 commit comments