ichord / At.js

Add Github like mentions autocomplete to your application.
http://ichord.github.com/At.js
MIT License
5.3k stars 668 forks source link

Default matcher callback's regex will not match mixed ascii + non-ascii characters #562

Open dixon opened 6 years ago

dixon commented 6 years ago

First, just want to thank you for such an amazing library!

Some of our users have mixed ascii and non-ascii characters in their names, e.g. Sᴀᴜʟ123, which makes the DEFAULT_CALLBACKS.matcher function's regex fail, as it will either match all ascii or all non-ascii:

https://github.com/ichord/At.js/blob/1b7a52011ec2571f73385d0c0d81a61003142050/src/default.coffee#L56

I've overridden this callback for now with this regex: /(?:^|\s)@((?:([A-Za-zÀ-ÿ0-9_'.+-]|[^\x00-\xff]))*)$/, which combines the two character classes into a single capturing group.

Is there a specific reason that ascii and non-ascii groupings should be considered separate?

Again, thank you for all your work on this project :)