asp.net - Regular expression validation (should start with character ) -


In my web application, I have a text box.

The user should enter a value in it. The first letter is a digit, is not a digit, and the remaining characters can be alphanumeric.

How do I write a regular expression to do this?

You can use: [a-za-z] \ w * To ensure that the first letter is a letter and any remaining characters are alphanumeric ( * )

  & lt; Asp: RegularExpressionValidator ID = "rev" runat = "server" ControlToValidate = "txtBox" error message = "must be optional by using first character is a letter!" Validation Execution = "[AZAZ] \ w *" /> & Lt; Asp: RequiredFieldValidator ID = "rfv" runat = "server" controlToValidate = "txtbox" error message = "value may not be blank" />  

Regarding the empty entries, RegularExpressionValidator is required in conjunction with. If that textbox is optional, and when something is recorded, it needs to be validated, so you do not have to use the required RequiredFieldValidator.


Comments

Popular posts from this blog

MySql variables and php -

php - Laravel - Overriding a resource route into a different route filter group -

url rewriting - How to implement the returnurl like SO in PHP? -