在易语言中正则表达式:<h1>\s+(.*?)\s+</h1>\s+<h2>\s+(.*?)\s+</h2>在火山安卓中无法匹配。如果只匹配子文本一是可以的,加上子文本二就不行了如图:
只匹配子文本一成功的表达式:<h1>\s+(.*?)\s+</h1>
匹配子文本一和子文本二失败的表达式:<h1>\s+(.*?)\s+</h1>\s+<h2>\s+(.*?)\s+</h2>
这种我感觉跟换行有关但是用[\s\S]*也匹配不到子文本二,我是想把子文本二作为一个整体然后需要再创建正则表达式再匹配。现在是取不出子文本二这个整体。
源文本:
[JavaScript] 纯文本查看 复制代码 <h1>
<a href="list-255.html">东南汽车</a>
</h1>
<h2>
<a href="list-461.html">戈蓝</a>
<a href="list-462.html">菱帅</a>
<a href="list-463.html">菱悦</a>
<a href="list-464.html">菱致</a>
<a href="list-465.html">得利卡</a>
<a href="list-466.html">富利卡</a>
<a href="list-1171.html">DX3</a>
<a href="list-1217.html">DX7</a>
</h2>
</div>
<div class="nav_second">
<h1>
<a href="list-256.html">长丰猎豹</a>
</h1>
<h2>
<a href="list-1214.html">猎豹CT5</a>
<a href="list-471.html">猎豹CT7</a>
<a href="list-472.html">猎豹Q6</a>
<a href="list-473.html">猎豹CS6</a>
<a href="list-474.html">猎豹CS7</a>
<a href="list-1083.html">猎豹CS9 EV</a>
<a href="list-475.html">猎豹CS10</a>
<a href="list-1211.html">猎豹C5 EV</a>
<a href="list-476.html">黑金刚</a>
<a href="list-1089.html">飞腾</a>
<a href="list-1215.html">Mattu</a>
</h2>
</div>
<div class="nav_second">
<h1>
<a href="list-257.html">江铃汽车</a>
</h1>
<h2>
<a href="list-478.html">宝典</a>
<a href="list-477.html">全顺</a>
<a href="list-479.html">宝威</a>
<a href="list-488.html">域虎</a>
<a href="list-1227.html">凯威</a>
<a href="list-1294.html">凯运</a>
<a href="list-1295.html">凯锐</a>
<a href="list-1284.html">特顺</a>
<a href="list-1292.html">顺达</a>
<a href="list-483.html">驭胜</a>
<a href="list-1647.html">江铃大道</a>
<a href="list-490.html">撼路者</a>
<a href="list-486.html">陆风X5</a>
<a href="list-485.html">陆风X6</a>
<a href="list-487.html">陆风X7</a>
<a href="list-484.html">陆风X8</a>
<a href="list-489.html">途睿欧</a>
<a href="list-480.html">陆风风尚</a>
<a href="list-482.html">陆风风华</a>
<a href="list-481.html">陆风JX6474E</a>
<a href="list-1253.html">E系列</a>
</h2>
</div>
<div class="nav_second">
<h1>
<a href="list-258.html">广汽传祺</a>
</h1>
<h2>
<a href="list-1110.html">GA3</a>
<a href="list-1456.html">GA4</a>
<a href="list-493.html">GA5</a>
<a href="list-1096.html">GA6</a>
<a href="list-1521.html">GA8</a>
<a href="list-1053.html">GE3</a>
<a href="list-1641.html">GM6</a>
<a href="list-1229.html">GM8</a>
<a href="list-1455.html">GS3</a>
<a href="list-491.html">GS4</a>
<a href="list-492.html">GS5</a>
<a href="list-1097.html">GS7</a>
<a href="list-1047.html">GS8</a>
<a href="list-1642.html">M6</a>
<a href="list-1511.html">M8</a>
<a href="list-1639.html">影豹</a>
<a href="list-1640.html">影酷</a>
</h2>
|