Pattern#1
Regex objNotNaturalPattern=new Regex("[^0-9]");
Pattern#1 will match for strings other than 0 to 9.^ symbol is used for Specifying not condition.[] brackets if we are to give range values such as 0 - 9 or a-z or A-Z eg. abc will return true
Pattern#
Regex objNaturalPattern=new Regex("0*[1-9][0-9]*");
Pattern#2 will match for string which are Natural Numbers.Natural numbers Are numbers which are always greater than 0.The pattern 0* tells that a natural Number can be prefixed with any number of zero's or no zero's.the next [1-9] tells that it should contain atleast one number from 1 to 9 followed by any numbers of
0-9's
7.4.08
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment