iphone中使用第三方工具(RegexKitLite)实现正则表达式
来源:互联网 发布:ip地址查询域名 编辑:程序博客网 时间:2024/05/12 16:15
1.去RegexKitLite下载类库,解压出来会有一个例子包及2个文件,其实用到的就这2个文件,添加到工程中。
备用地址:
http://www.cocoachina.com/bbs/job.php?action-download-pid-135286-tid-18111-aid-11143.html
- Lv
2.工程中添加libicucore.dylib frameworks。
3.现在所有的nsstring对象就可以调用RegexKitLite中的方法了。
NSString *email = @”kkk@aaa.com”;
[email isMatchedByRegex:@"\\b([a-zA-Z0-9%_.+\\-]+)@([a-zA-Z0-9.\\-]+?\\.[a-zA-Z]{2,6})\\b”];
返回YES,证明是email格式,需要注意的是RegexKitLite用到的正则表达式和wiki上的略有区别。
searchString = @”http://www.example.com:8080/index.html”;
regexString = @”\\bhttps?://[a-zA-Z0-9\\-.]+(?::(\\d+))?(?:(?:/[a-zA-Z0-9\\-._?,'+\\&%$=~*!():@\\\\]*)+)?”;
NSInteger portInteger = [[searchString stringByMatching:regexString capture:1L] integerValue];
NSLog(@”portInteger: ‘%ld’”, (long)portInteger);
// 2008-10-15 08:52:52.500 host_port[8021:807] portInteger: ‘8080′
取string中http的例子。 1.去RegexKitLite下载类库,解压出来会有一个例子包及2个文件,其实用到的就这2个文件,添加到工程中。
备用地址:
http://www.cocoachina.com/bbs/job.php?action-download-pid-135286-tid-18111-aid-11143.html
- Lv
2.工程中添加libicucore.dylib frameworks。
3.现在所有的nsstring对象就可以调用RegexKitLite中的方法了。
NSString *email = @”kkk@aaa.com”;
[email isMatchedByRegex:@"\\b([a-zA-Z0-9%_.+\\-]+)@([a-zA-Z0-9.\\-]+?\\.[a-zA-Z]{2,6})\\b”];
返回YES,证明是email格式,需要注意的是RegexKitLite用到的正则表达式和wiki上的略有区别。
searchString = @”http://www.example.com:8080/index.html”;
regexString = @”\\bhttps?://[a-zA-Z0-9\\-.]+(?::(\\d+))?(?:(?:/[a-zA-Z0-9\\-._?,'+\\&%$=~*!():@\\\\]*)+)?”;
NSInteger portInteger = [[searchString stringByMatching:regexString capture:1L] integerValue];
NSLog(@”portInteger: ‘%ld’”, (long)portInteger);
// 2008-10-15 08:52:52.500 host_port[8021:807] portInteger: ‘8080′
取string中http的例子。 1.去RegexKitLite下载类库,解压出来会有一个例子包及2个文件,其实用到的就这2个文件,添加到工程中。
备用地址:
http://www.cocoachina.com/bbs/job.php?action-download-pid-135286-tid-18111-aid-11143.html
- Lv
2.工程中添加libicucore.dylib frameworks。
3.现在所有的nsstring对象就可以调用RegexKitLite中的方法了。
NSString *email = @”kkk@aaa.com”;
[email isMatchedByRegex:@"\\b([a-zA-Z0-9%_.+\\-]+)@([a-zA-Z0-9.\\-]+?\\.[a-zA-Z]{2,6})\\b”];
返回YES,证明是email格式,需要注意的是RegexKitLite用到的正则表达式和wiki上的略有区别。
searchString = @”http://www.example.com:8080/index.html”;
regexString = @”\\bhttps?://[a-zA-Z0-9\\-.]+(?::(\\d+))?(?:(?:/[a-zA-Z0-9\\-._?,'+\\&%$=~*!():@\\\\]*)+)?”;
NSInteger portInteger = [[searchString stringByMatching:regexString capture:1L] integerValue];
NSLog(@”portInteger: ‘%ld’”, (long)portInteger);
// 2008-10-15 08:52:52.500 host_port[8021:807] portInteger: ‘8080′
取string中http的例子。
备用地址:
http://www.cocoachina.com/bbs/job.php?action-download-pid-135286-tid-18111-aid-11143.html
- Lv
2.工程中添加libicucore.dylib frameworks。
3.现在所有的nsstring对象就可以调用RegexKitLite中的方法了。
NSString *email = @”kkk@aaa.com”;
[email isMatchedByRegex:@"\\b([a-zA-Z0-9%_.+\\-]+)@([a-zA-Z0-9.\\-]+?\\.[a-zA-Z]{2,6})\\b”];
返回YES,证明是email格式,需要注意的是RegexKitLite用到的正则表达式和wiki上的略有区别。
searchString = @”http://www.example.com:8080/index.html”;
regexString
NSInteger portInteger = [[searchString stringByMatching:regexString capture:1L] integerValue];
NSLog(@”portInteger: ‘%ld’”, (long)portInteger);
// 2008-10-15 08:52:52.500 host_port[8021:807] portInteger: ‘8080′
取string中http的例子。
备用地址:
http://www.cocoachina.com/bbs/job.php?action-download-pid-135286-tid-18111-aid-11143.html
- Lv
2.工程中添加libicucore.dylib frameworks。
3.现在所有的nsstring对象就可以调用RegexKitLite中的方法了。
NSString *email = @”kkk@aaa.com”;
[email isMatchedByRegex:@"\\b([a-zA-Z0-9%_.+\\-]+)@([a-zA-Z0-9.\\-]+?\\.[a-zA-Z]{2,6})\\b”];
返回YES,证明是email格式,需要注意的是RegexKitLite用到的正则表达式和wiki上的略有区别。
searchString = @”http://www.example.com:8080/index.html”;
regexString
NSInteger portInteger = [[searchString stringByMatching:regexString capture:1L] integerValue];
NSLog(@”portInteger: ‘%ld’”, (long)portInteger);
// 2008-10-15 08:52:52.500 host_port[8021:807] portInteger: ‘8080′
取string中http的例子。
备用地址:
http://www.cocoachina.com/bbs/job.php?action-download-pid-135286-tid-18111-aid-11143.html
- Lv
2.工程中添加libicucore.dylib frameworks。
3.现在所有的nsstring对象就可以调用RegexKitLite中的方法了。
NSString *email = @”kkk@aaa.com”;
[email isMatchedByRegex:@"\\b([a-zA-Z0-9%_.+\\-]+)@([a-zA-Z0-9.\\-]+?\\.[a-zA-Z]{2,6})\\b”];
返回YES,证明是email格式,需要注意的是RegexKitLite用到的正则表达式和wiki上的略有区别。
searchString = @”http://www.example.com:8080/index.html”;
regexString
NSInteger portInteger = [[searchString stringByMatching:regexString capture:1L] integerValue];
NSLog(@”portInteger: ‘%ld’”, (long)portInteger);
// 2008-10-15 08:52:52.500 host_port[8021:807] portInteger: ‘8080′
取string中http的例子。
- iphone中使用第三方工具(RegexKitLite)实现正则表达式
- iphone中使用第三方工具(RegexKitLite)实现正则表达式
- iphone中使用第三方工具(RegexKitLite)实现正则表达式
- iphone中使用第三方工具(RegexKitLite)实现正则表达式
- iphone中使用第三方工具(RegexKitLite)实现正则表达式
- iphone中使用第三方工具(RegexKitLite)实现正则表达式
- iphone中使用第三方工具(RegexKitLite)实现正则表达式
- IOS使用第三方工具(RegexKitLite)实现正则表达式
- IOS使用第三方工具(RegexKitLite)实现正则表达式
- iOS使用第三方工具(RegexKitLite)实现正则表达式
- iPhone中用第三方工具(RegexKitLite)实现正则表达
- IOS使用第三方工具(RegexKitLite)实现正则表达式小结
- [iphone]使用(RegexKitLite)实现正则表达式 [转]
- [iphone]使用(RegexKitLite)实现正则表达式 [转]
- 关于IOS第三方库RegexKitLite使用正则表达式查找NSString中的IP地址
- RegexKitLite实现正则表达式
- iOS中使用正则表达式 RegexKitLite
- 使用RegexKitLite使iphone也可以使用正则表达式
- 揭秘:美国国防部用什么样的操作系统
- echo命令详解
- svn:external 用法
- 骗取搜索引擎排名的黑帽SEO方法说明
- @RequestMapping
- iphone中使用第三方工具(RegexKitLite)实现正则表达式
- 2011-09-01--RandomAccessFile 随机读取文件
- android Intent的一些用法
- iphone--RegexKitLite wouldn't compile
- WPF: WrapPanel 容器的数据绑定(动态生成控件、遍历)
- JVM内存管理:深入Java内存区域与OOM
- #define WINVER0x0501 之后菜单不显示图标了
- 结构体和类的区别
- iphone--使用HTTP请求 查找指定位置附近的景点(GOOGLE 地图)