Regular expression for validating name in asp net
Introduction This article is about a Windows application and presents a more involved example that uses Regular Expressions to validate name, address and telephone number information input by a user.
Before explaining the sample I would like to provide a little explanation of Regular Expressions.
Here Mudassar Ahmed Khan has explained, how to allow only Alphanumeric character values i.e.alphanumeric values with space character, thus unless a special character key has been specified to be excluded it won’t be accepted.Here Mudassar Ahmed Khan has shared the following Regular Expressions (Regex) for validating decimal numbers in Text Box. Regular Expressions (Regex) to match number with decimal precision of exact 1 decimal place. Regular Expressions (Regex) to match number with decimal precision of exact 2 decimal places. Regular Expressions (Regex) to match number with decimal precision of upto 2 decimal places.If the program code does not match the Regular Expression then the compiler indicates that there is a syntax error. When a user clicks the OK button, the program checks to ensure that none of the fields are empty.
If one or more fields are empty then the program displays a message to the user that all fields must be filled in before the program can validate the input information. Is Match(text, @" # Validate username with 5 constraints. # 1- only contains alphanumeric characters , underscore and dot.