您的位置:首页 > 移动开发 > IOS开发

ios 正則表達式替换

2016-02-01 10:21 330 查看
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.length) withTemplate:@""];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: