首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用Regex在崇高文本中转换HTML抓取类和内部字符串

用Regex在崇高文本中转换HTML抓取类和内部字符串
EN

Stack Overflow用户
提问于 2014-01-02 20:49:29
回答 1查看 68关注 0票数 0

我很清楚parsing HTML with Regular Expressions的危险,但我现在很困难,需要加快速度!我有一个代码块:

代码语言:javascript
复制
<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>

我需要把它变成这样:

代码语言:javascript
复制
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.";

最好有一个正则表达式,以崇高的文本表示。

这就是我到目前为止所拥有的。

代码语言:javascript
复制
.+i class=\"fc-icon-(.+)\".+
$1
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-01-02 21:03:20

这就是我降落的地方:

代码语言:javascript
复制
<div class=\"row\">
    <div class=\"span1\"><i class=\"fc-icon-(.+)\"></i>
    </div>
    <div class=\"span4\">(.+)</div>
</div>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20891600

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档