Regular Expresions
You want
1) Only a number
2) The number must be positive
3) The number must not be zero
Note :- Also you can not put zero to front of any positive number too.
Ex :- 8 is OK but 08 is an error.
Then below is the regular expression ..
----------------------
You want,
accepted scale 99999.99999 :-
Then below the regular expression
^\d{1,5}(\.\d{1,5})?$
----------------------------------
You want,
accepted year. (Four number digits only)
Then below the regular expression
^\d{4,4}(\.\d{0,0})?$
----------------------------------------
Enter a valid telephone number
^(0[0-9]{9})|(\+[0-9]{11,14})$
Enter a positive number , no points ..
^\d+$
Also You want to validate a correct email address.
ReplyDeleteThen use below one.
^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$
Also You want to validate a correct precentage with "%" sign
ReplyDeleteThen use below one.
(?!^0*$)(?!^0*\.0*$)^\d{1,2}(\.\d{1,2})?$