你好我的網站中的所有用戶都可以使用表格格式插入數據。該表可以是任何風格。但即時通訊使用正則表達式給這些表格我們的網站的標準格式。但即時通訊使用正則表達式它運作良好,但它是刪除colspan。但我需要colspan widout它表看起來很奇怪。 任何人都請告訴我我的正則表達式錯誤? 以下是我的正則表達式代碼:正則表達式的一些問題
$table=eregi_replace("<table[^>]*>","<table width='100%' border='0' cellspacing='0' cellpadding='0' class='tabularData'>", $table);
$table= preg_replace('/style\s*=\s*(\'|").+(\'|")/i', '', $table);
$table= preg_replace('/bgcolor\s*=\s*(\'|").+(\'|")/i', '', $table);
$table=eregi_replace("<span[^>]*>","",$table);
在此先感謝:)
ereg函數已被棄用。 – kennytm 2010-06-17 09:35:28
而且ereg和preg功能混合在一起更是如此。 – BoltClock 2010-06-17 09:36:06
使用正則表達式解析HTML更是ewww。 :) – 2010-06-17 09:36:39