如何解决使用Powershell删除不必要的字符串和特殊字符
我有这个字符串:
$html = @'
<div><span style="display:inline !important;">As an Inventory and OperationsAgent</span></div><div><span style="display:inline !important;">I want to be able to raise internal EPL Nominations for Buildings that are going through a Shared Installation journey</span></div><div><span style="display:inline !important;">So that internal EPLNominations can be submitted when the TDF cost is too expensive for both P2P and Shared</span></div>
'@
...如何删除所有HTML标记?
解决方法
您可以使用-replace
正则表达式运算符删除所有html标记:
$html -replace '<[^>]+>'
也用,
代替<div>
边界:
$html -replace '</div>\s*<div>',',' -replace '<[^>]+>'
这将输出一个类似于以下的字符串
,作为Inventory and OperationsAgent,我希望能够提高正在经历共享安装过程的建筑物的内部EPL提名,以便当TDF成本对于P2P和Shared而言都太昂贵时,可以提交内部EPL提名。 / p>
您可以先解码html,然后替换html标签:
return splash:select('#my-element'):png()
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。