How way to use regex_search for validate only alpha numeric

i want use regex_search to validate form input in login view, but i don't know way to use it any example to use this regex for validate that user only can input alpha numeric?

I'm guessing you are looking for a valid username.

There are two options:

1) get all alphanumeric characters in username and see if it matches the username exactly.

2) get all non-alphanumeric characters in username and see if it has size>0.

I'd rather do number 2) and used the invalid characters in the feedback, as in "you can't use * in the username".

The alphanumeric characters are represented by \w. The non-alphanumeric by \W.

Hi Erron,

Is it something like this that you're looking for?