Swift: how to display image from html source
问题 How can I display image from html source in some of sites in swift 2.2? Actually I don't have any JSON or XML. The important thing is that I have to use regex. I tried this: if htmlContent != nil { let htmlContent = (item?.htmlContent)! as NSString var imageSource = "" let rangeOfString = NSMakeRange(0, htmlContent.length) let regex = try! NSRegularExpression(pattern: "(<img.*?src=\")(.*?)(\".*?>)", options: [.CaseInsensitive]) if htmlContent.length > 0 { let match = regex.firstMatchInString