开发者

Using Regexkitlite in iPhone,iPad

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜