[英]Regex for matching html tags with escaped characters
I'm using regex to help me filter out HTML in a localisation project that I don't want to translate. 我正在使用正则表达式来帮助我过滤掉我不想翻译的本地化项目中的HTML。 Normally I use
</?\\w+((\\s+\\w+(\\s*=\\s*(?:".*?"|'.*?'|[^'">\\s]+))?)+\\s*|\\s*)/?>
but the content I'm translating has escaped characters in the HTML such as 通常我使用
</?\\w+((\\s+\\w+(\\s*=\\s*(?:".*?"|'.*?'|[^'">\\s]+))?)+\\s*|\\s*)/?>
但我正在翻译的内容已转义HTML中的字符,例如
<a href\="http\://www.fau.de/studium/zulassung/einschreibung/" target\="_blank" title\="Externer Link auf die Webseite der FAU">
Can some kind soul help me work out how to match html tags containing slashes where they shouldn't really be? 某种友善的灵魂可以帮助我确定如何匹配包含斜杠的html标签吗?
我使用“ /<(.|\\n)*?>/g”来匹配文本中的所有HTML标记,这对于我忽略了此内容非常有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.