jakiestfu / Mention.js

Lightweight wrapper for adding @user mention functionality to Twitter Bootstraps Typeahead plugin
http://jakiestfu.github.com/Mention.js/
MIT License
750 stars 144 forks source link

Matching event always occurs when username have a period in the user name #25

Open bigfetz opened 10 years ago

bigfetz commented 10 years ago

I have some user names like this -> john.smith

When I select those type of user names and try to type more stuff with out entering the delimiter it always pops open the modal. When I select a username with out a period then it works fine.

bigfetz commented 10 years ago

I fixed this issue but only for my cases. In the _matcher function it checks via regex for matched. The original regex was //w+ but this does not grab periods or dashes.

[\w.-]* allows for a user name to have periods and dashes and for the code to work properly. You can easily add more to this regex and it will allow for the code to work as normal.

kjantzer commented 9 years ago

:+1: Had this issue too.

Changed the regex on line 51 from: \\w+ to [\\w\\.\\-]* to solve the problem.
Thanks @bigfetz

gsgnh commented 3 months ago

So many years, later, this code is great for a beginner. This fix worked for me. Thank you!