Last active
December 10, 2015 00:29
-
-
Save dnnta/4351830 to your computer and use it in GitHub Desktop.
去掉Html标签
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString *htmlStr = @"This is a <br />string with html <strong>tag</strong>."; | |
NSRange range; | |
while ((range = [htmlStr rangeOfString:@"< [^>]+>" options:NSRegularExpressionSearch]).location != NSNotFound){ | |
htmlStr = [htmlStr stringByReplacingCharactersInRange:range withString:@""]; | |
} | |
<p [stylealign]{5}=".*?">.*?<img.*?src="(.*?)".*?/>.*?</p>[\r\n]+<p [stylealign]{5}=".*?">[\r\n\s]*?(.*?)</p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment