Checking user id and password for only character and numbers using Regular ExpressionWe can check the entered user id of any user within a web form by using Regular Expression. This is to prevent user or attacker to use other characters and codes in the input field. Here we will check for special characters but checking for special characters and then for length is a bit lengthy process so we will check for existence of characters, numbers and number of characters used.We can imitate the regular expression object of VBScript like this. dim RExp : set RExp = new RegExpBy using this object we can check any string.Here is the complete code. The output of this is true or false based on the result of validation.
Dim userid
Here only characters lower or upper case along with numbers is allowed. The length of the string has to be minimum 3 and maximum 8 char length.
Here is some different values of the string ( userid ) for which the validation will pass and output will be True.
|