网站:
http://codecloud.net/regular-3519.html
截取文字
NSString *searchText = @"要在标题栏上显示的文字test11111111111111111111<img src=\http://www.myexception.cn/img/2013/02/01/1138391367.png\"></body</html>";
// NSError *error = NULL;// NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"(?<=title\>).*(?=</title)"options:NSRegularExpressionCaseInsensitive error:&error];
NSTextCheckingResult *result = [regex firstMatchInString:searchText options:0 range:NSMakeRange(0, [searchText length])];
if (result) {
NSLog(@"%@\n", [searchText substringWithRange:result.range]);
}
下面的是图片的正则表达式(好像是很好用,有简单版的,但是站主推荐这个)
((http[s]{0,1}|ftp)://[a-zA-Z0-9\\.\\-]+\\.([a-zA-Z]{2,4})(:\\d+)?(/[a-zA-Z0-9\\.\\-~!@#$%^&*+?:_/=<>]*)?)|(www.[a-zA-Z0-9\\.\\-]+\\.([a-zA-Z]{2,4})(:\\d+)?(/[a-zA-Z0-9\\.\\-~!@#$%^&*+?:_/=<>]*)?)
网站:
http://blog.csdn.net/ztp800201/article/details/8116081