Can any one tell how can we set the regular expression in regexkitlite for validating float 开发者_开发技巧numbers,email,web address..etc....or can any one say what is the rules for using the expression ?
The RegexKitLite homepage has a bunch of examples on how to do the common things you ask. Check out the RegexKitLite Cookbook. Among other things you will find examples on how to do:
- floating point:
[+\-]?(?:[0-9]*\.[0-9]+|[0-9]+\.)
- email:
\b([a-zA-Z0-9%_.+\-]+)@([a-zA-Z0-9.\-]+?\.[a-zA-Z]{2,6})\b
But you should really take a look at those examples. There are many good examples on how to solve common tasks.
You do a
[text stringByMatching:@"..."]
and if that call returns nil, then your number, email, etc. isn't accepted.
精彩评论