删除HTML" img src"来自字符串的标记

时间:2015-06-11 06:23:04

标签: ios regex swift

我正在尝试从字符串中删除图像src标记。

我一直在StackOverflow上关注过去question,但它似乎并没有摆脱img src。

例如:

<img src="http://www.japanator.com/ul/33930-One Piece 696 cover 2.jpg

分为:

http://www.japanator.com/ul/33930-One Piece 696 cover 2.jpg

我的代码输出:

<img src="http://www.japanator.com/ul/33930-One Piece 696 cover 2.jpg

我的代码:

var images = item.summary.imageLinksFromHTMLString.first
var HTMLTagss: NSString = "<img[^>]*>" //regex to remove img tag
var stringWithoutImage: NSString = images!.stringByReplacingOccurrencesOfString(HTMLTagss as String, withString: "", options: nil,range:nil)
println(stringWithoutImage)

0 个答案:

没有答案