作者No (you stay there)
看板RegExp
標題Re: [問題] 該怎麼寫(改善) 我的 Regexp
時間Fri May 10 22:24:49 2013
※ 引述《hpo14 (雨)》之銘言:
我用JavaScript測試的
但應該差不多,要是不能用中文的話,把中文轉\uXXXX看看
/cview\('(\d+)-(\d+)\.html',(\d+)[^第番]+(第\d+[卷話]|番外\d+)/
^^^ ^^^ ^^^ ^^^^^^^^^^^^^^^^^^^
共四個sub-group
==============測試資料=============
<!-- 一堆 html -->
<td style="width:10%;white-space:nowrap;"><a h
ref='#'
onclick="cview('102-1.html',1);return false;" id="c1" class="Vol">
第01卷</a></td><td style="width:10%;white-space:nowrap;"><a href='#'
onclick="cview('102-2.html',1);return false;" id="c1" class="Vol">
第02話</a></td><td style="width:10%;white-space:nowrap;"><a href='#'
onclick="cview('102-3.html',1);return false;" id="c3" class="Vol">
<font color=red id=lch>第03話</font></a></td><td
style="width:10%;white-space:nowrap;"><a href='#'
onclick="cview('102-4.html',1);return false;" id="c4" class="Vol">
第04話 各話標題</a></td><td style="width:10%;white-space:nowrap;"><a href='#'
onclick="cview('102-5.html',1);return false;" id="c4" class="Vol">
<font color=red id=lch>第05話 各話標題</font></a></td><td
style="width:10%;white-space:nowrap;"><a href='#'
onclick="cview('102-6.html',1);return false;" id="c4" class="Vol">
番外06</a></td><td style="width:10%;white-space:nowrap;"><a href='#'
onclick="cview('102-7.html',1);return false;" id="c4" class="Vol">
<font color=red id=lch>番外07</font></a></td><td
style="width:10%;white-space:nowrap;"><a href='#'
以此後面類推
<!-- 一堆 html -->
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 123.192.72.221
1F:推 s25g5d4:這解法比我的還簡潔有力阿 推 05/10 22:32
2F:推 Rockspirit:學長超強~推! 05/26 23:05