[Solved] Regular Expression in MVC5 [closed]


You generally use ranges such as [a-z] and [0-9] to filter out just characters and numbers with an asterisk after it *

I don’t have a copy of MVC 5 handy so I don’t know what the particular syntax is.

A regex for that often looks like:

([0-9]|[A-Z]|[a-z])*

It will be very similar in asp.net or mvc, likely.

That searches for all alphabetic characters from a to z, and all numbers from 0 to 9. The asterisk makes it search for multiple characters and not just a single character at a time. The pipe character says “or”. Search for characters upper case, or characters lower case, or numbers. The brackets help sort groups.

As I said though you will have to figure it out the specific syntax of your regex library that your programming language uses, as they can differ. There are perl style regexes, and many variations. The above is just a sample. You can test at:
http://regexstorm.net/tester

solved Regular Expression in MVC5 [closed]