我想從this page獲取所有性能ID。使用REGEX解析數據源
<?php
$content = file_get_contents("http://www124.popmundo.com/Common/Performances.asp?action=ComingPerformances&ArtistID=1962457");
$regex = "Performances\.asp\?action=Arrangements&PerformanceID=([0-9]+)";
//$regex = "/Performances\.asp\?action=Arrangements&PerformanceID=([0-9]+)/";
//$regex = "/Performances\.asp\?action=Arrangements&PerformanceID=([0-9]+)/s";
//all pattern variations tested, not working
if(preg_match_all($regex, $content, $m))
print_r($m);
else
echo "FALSE";
// this is returning FALSE
您可能會看看[這] [1]個問題。 [1]:http://stackoverflow.com/questions/3627489/php-parse-html-code – Ziggy
@Ziggy,它不使用正則表達式 – Eray
是否有您要使用正則表達式一個特別的原因?如果你的代碼在字符串文字中包含很大的難以閱讀的正則表達式,它可能會更難以閱讀和維護。 – Ziggy