Reputation: 131
what is Mysql query REGEXP to call this?
@text
@user_name
@4ll_r1ght
@last2
@_last1
@and1more_
Upvotes: 1
Views: 1238
Reputation: 12356
SELECT * FROM users WHERE username REGEXP '^\@[0-9a-zA-Z_]+$'
Will select users with usernames starting with @
and consisting of only alphanumeric characters (at least one).
Upvotes: 2
Reputation:
I hope you are looking for regular expression for username with specified characters.
Try below :
^[a-zA-Z0-9._-]+@
This part of the expression validates the ‘username’ section of the email address. The hat sign (^) at the beginning of the expression represents the start of the string.
If we didn’t include sign (^), then someone could key in anything they wanted before the email address and it would still validate.
Here, we are allowing the letters a-z, A-Z, the numbers 0-9, and the symbols underscore (_), period (.), and dash (-). You can add/remove them according to your needs.
Upvotes: 1