开发者

Using Regexkitlite in iPhone,iPad

开发者 https://www.devze.com 2023-01-28 16:41 出处:网络
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 expressi

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

精彩评论

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