[英]Get text between tags using regex from HTML mail
我遇到了一种HTML邮件格式,其中在"<![if !supportLists]>" and "<![endif]>"
标签之间存在一些文本。 我想使用正则表达式提取这些标签之间的文本。 这是示例文本格式输入:
"<![if !supportLists]><span style='mso-list:Ignore'>Index<span style='font:7.0pt "Times New Roman"'> Value </span></span><![endif]>"
预期的输出: "Index Value "
不要在HTML中使用正则表达式,例如@Justinas已经提到的,在您的情况下,您可以尝试使用jQuery之类的api:
str = '<![if !supportLists]><span style="mso-list:Ignore">Index<span style="font:7.0pt Times New Roman"> Value </span></span><![endif]>'
$(str).text();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.