我想解析出一個多行字符串使用Perl,但我只得到匹配的數量。下面是我解析的樣品:如何在Perl中使用正則表達式分析多行HTML
<div id="content-ZAJ9E" class="content">
Wow, I love the new top bar, so much easier to navigate now :) Anywho, got a few other fixes I am working on as well. :) I hope you all like the new look.
</div>
我試圖讓內容來使用此代碼存儲在一個字符串:
@a = ($html =~ m/class="content">.*<\/div>/gs);
print "array A, size: ", @a+0, ", elements: ";
print join (" ", @a);
print "\n";
,但它不是返回整個事情只是文本在div中。有人能指出我的正則表達式中的錯誤嗎?
Marisa
如果其中一個答案解決您的問題,請[接受](http://stackoverflow.com/faq#howtoask),以便其他人可以看到它是有益的。 – simbabque