这是我的问题:
我正在尝试从 NSString 对象中过滤掉 html 标签。
对此的大多数修复只是删除了介于 < 和 > 之间的所有内容,以及这些字符本身。我试图找出一种方法来删除“< ... >”子字符串,前提是它不包含空格或换行符。
我想这样做的方式看起来像这样
while ([source rangeOfString@"someRegEx" options:NSRegularExpressionSearch].location != NSNotFound) {
//find the range of the substring
//check for newlines/whitespace characters
//replace occurrences of the string with "" if it doesn't have them
}
首先,这似乎是一个好方法吗?其次,我在弄清楚该正则表达式的样子时遇到了很多问题……有人知道它可能是什么样子吗?