我很清楚parsing HTML with Regular Expressions的危险,但我现在很困难,需要加快速度!我有一个代码块:
<div class="row">
<div class="span1"><i class="fc-icon-letterpress-circle"></i>
</div>
<div class="span4">This design is letterpressed onto the finest quality salvaged paper made here in the USA.</div>
</div>
<div class="row">
<div class="span1"><i class="fc-icon-madeinusa-circle"></i>
</div>
<div class="span4">We work hard to be able to say that this product is proudly created right here in the USA.</div>
</div>
<div class="row">
<div class="span1"><i class="fc-icon-cotton-circle"></i>
</div>
<div class="span4">This product is made from tree-free paper sourced from salvaged cotton from the textile industry.</div>
</div>我需要把它变成这样:
letterpress-circle, "This design is letterpressed onto the finest quality salvaged paper made here in the USA.";
madeinusa-circle, "We work hard to be able to say that this product is proudly created right here in the USA.";
cotton-circle, "This product is made from tree-free paper sourced from salvaged cotton from the textile industry.";最好有一个正则表达式,以崇高的文本表示。
这就是我到目前为止所拥有的。
.+i class=\"fc-icon-(.+)\".+
$1发布于 2014-01-02 21:03:20
这就是我降落的地方:
<div class=\"row\">
<div class=\"span1\"><i class=\"fc-icon-(.+)\"></i>
</div>
<div class=\"span4\">(.+)</div>
</div>https://stackoverflow.com/questions/20891600
复制相似问题