dimanche 27 août 2017

Mentioning a user with @ using Linkify and regex

I'm currently using the following pattern:

Pattern mentionPattern = Pattern.compile("@([A-Za-z0-9_]+)");

This will find a user named @user for example, but it won't find @user. or @user!hello. I'd like to basically capturing everything until the first whitespace. What pattern can I use to find these kinds of usernames?

Aucun commentaire:

Enregistrer un commentaire