I need a javascript regular expression to match twitter usernames.
The username is entered by the user while signing up, so I don\'t want to distract them with too m
It may be more than you need but I found this in another post "regex how to replace twitter links". Wraps @usernames, #hashtags and urls. Working well for me.
function processTweetLinks(text) {
var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi;
text = text.replace(exp, "$1");
exp = /(^|\s)#(\w+)/g;
text = text.replace(exp, "$1#$2");
exp = /(^|\s)@(\w+)/g;
text = text.replace(exp, "$1@$2");
return text;
}