2010 Archives
RegexKitLite 之前搞过,但是内弄清楚,这次必须搞好。
下面是测试代码,在SDK 4.0 上通过。3.2一下NSRegularExpressionSearch 不支持,自己想办法吧。
-(void)test
{
NSString *html=[NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"1.html" ofType:nil] encoding:NSUTF8StringEncoding error:nil];
//NSString *exp=@"/(https?)://(\\d+))?((?:/[a-zA-Z0-9\\-._?,'+\\&%$=~*!():@\\]*)+)?/";
NSString *exp=@"http://[^ ]*.(png|jpeg|PNG|JPEG|JPG|jpg)";
NSRange r;
for(NSString *match in [html componentsMatchedByRegex:exp]) {
NSLog(@"111Phone number is %@", match);
}
r = [html rangeOfString:exp options:NSRegularExpressionSearch];
if (r.location != NSNotFound) {
NSLog(@"Phone number is %@", [html substringWithRange:r]);
} else {
NSLog(@"Not found.");
}
}
result = MakeServerConnection("gateway.sandbox.push.apple.com", 2195, &socket, &peer);
result = SSLSetPeerDomainName(context, "gateway.push.apple.com", 30);
if( homeViewObj != nil )
{
channelViewObj = [[CChannelsView alloc] init];
if( channelViewObj != nil )
{
searchViewObj = [[CSearchView alloc] init];
if( searchViewObj != nil )
{
downloadViewObj = [[CDownloadView alloc] init];
if( downloadViewObj != nil )
{
topicNaviObj = [[CTopicNavi alloc] init];
if ( topicNaviObj != nil )
{
rankingNaviObj = [[CRankingNaviView alloc] init];
if ( rankingNaviObj != nil )
{
collectionNaviObj = [[CollectionNavi alloc] init];
if ( collectionNaviObj != nil )
