Hmm, I tried your function and it worked on a small example:
var string = "<!DOCTYPE html> <html> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body> </html>"
let str = string.stringByReplacingOccurrencesOfString("<[^>]+>", withString: "", options: .RegularExpressionSearch, range: nil)
print(str)
//output " My First Heading My first paragraph. "
Can you give an example of a problem?
Swift 4 and 5 version:
var string = "<!DOCTYPE html> <html> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body> </html>"
let str = string.replacingOccurrences(of: "<[^>]+>", with: "", options: .regularExpression, range: nil)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…