href
我在标签的属性中有一组具有非法语法的 HTML 文件<a>
。例如,
<a name="Conductor, "neutral""></a>
或者
<meta name="keywords" content="Conductor, "hot",Conductor, "neutral",Hot wire,Neutral wire,Double insulation,Conductor, "ground",Ground fault,GFCI,Ground Fault Current Interrupter,Ground fault,GFCI,Ground Fault Current Interrupter,Arc fault circuit interrupter,Arc fault breaker,AFCI," />
或者
<b>Table of Contents:</b><ul class="xoxo"><li><a href="1.html" title="Page 1: What are "series" and "parallel" circuits?">What are "series" and "parallel" circuits?</a>
我正在尝试使用 Perl 的XML::Twig
模块处理文件parsefile_html($file_name)
。当它读取具有此语法的文件时,会出现以下错误:
x has an invalid attribute name 'y""' at C:/strawberry/perl/site/lib/XML/Twig.pm line 893
我需要的是一种让模块接受错误语法并处理它的方法,或者是一个正则表达式来用单引号查找和替换属性中的双引号。