ios 正則表達式替换

1. 不可变字符串   (content 是不可变)

NSRegularExpression *regularExpression = [NSRegularExpression regularExpressionWithPattern:

                                      @"<(/{0,})div(.{0,})>" options:0 error:nil];

 content  = [regularExpression stringByReplacingMatchesInString:content options:0 range:NSMakeRange(0, content.length) withTemplate:@""];


1. 可变字符串   (content 是可变)

 [regularExpression replaceMatchesInString:content options:0 range:NSMakeRange(0, content.lengthwithTemplate:@""];

posted @ 2016-02-01 10:21  mengfanrong  阅读(177)  评论(0编辑  收藏  举报