看板 RegExp 關於我們 聯絡資訊
※ 引述《yingwan (yingwan)》之銘言: (略過...) : 我用perl是這樣寫的: : open(IN, $file) || die "can't read $file"; : @file = <IN>; undef *TMP; for(@file) { $_ = $TMP . $_ if($TMP); while(/<[^>]+>/) { push(@TMP, $1) if(s/(<[^>]+>)//); } /(<[^>]+)/ ? $TMP = $1 : undef $TMP; } @file = map { s/ >/>/; s/\n//; s/ +/ /g; $_ } @TMP; : print "These are the opening tags:\n"; : foreach $line (@file){ : find_opening_tags($line); (略過...) 加上那一段就會和結果一樣了... -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.232.236.185
yingwan:你太強了啦,感謝 11/09 08:09