www.jhpeng.com

正則產生器

好用

http://www.txt2re.com/index-php.php3

 

 

其他工具,以便用戶建議包括:

PHP 讀取CSV格式的String

function ParseCSVString($str, $delim=',')
{
$mdarray = array();
//write the CSV string to a temporary file so that fgetcsv() can beused to process...
$fp = tmpfile();
fwrite($fp, $str);
rewind($fp); //rewind to process CSV
$csv_length = strlen($str);

$row = 0;
while (!feof($fp) ) {
    $data_arr = fgetcsv($fp, $csv_length, $delim);
    $num = count ($data_arr);
    $mdarray[$row] = array();
    for ($c=0; $c < $num; $c++) {
       print "第".$row."列". "<BR>";
        print "第".$c."排". "<BR>";
       $mdarray[$row][$c] = $data_arr[$c];
        print "mdarray[".$row."][".$c."]=".$data_arr[$c]."<BR>";
        print "驗證內容=".$mdarray[$row][$c]."<BR>";
    }       
    //print $data_arr[0] . $data_arr[1]. $data_arr[2] . "<BR>";
    $row++;
}

fclose($fp); //clean up temp file
return $mdarray; //return the array
}

 

======

 

CSV字串內容=

00:00~01:00,RFI法廣電台法語新聞,法國廣播

01:00~02:00,音樂瘋一點,Linda

02:00~03:00,賽門狂想曲,蕭曼屏

03:00~04:00,小魚兒的音樂河,小魚兒

04:00~05:00,空大教學節目,空中大學

05:00~06:00,長青天地,嘉惠

06:00~06:30,早安日語,孫寅華

06:30~07:00,開心學德語,張南思

07:00~07:30,初學空中美語,空中美語

07:30~08:00,長春藤生活英語,長春藤英語

08:00~09:00,囉哩囉唆講清楚,江峰、姜涵

09:00~10:00,後山姐妹的意想世界,王秀芳

10:00~10:05,東海岸新聞網,花蓮分臺

10:05~12:00,十點不一樣,黃凱昕

12:00~13:00,音樂廚房,吳采璋

13:00~13:30,活用空中美語,空中美語

13:30~14:00,長春藤解析英語,長春藤英語

14:00~15:00,左岸咖啡館,林文玲

15:00~15:05,東海岸新聞網,花蓮分臺

15:05~15:30,左岸咖啡館,林文玲

15:30~16:00,童盟國,林文玲

16:00~17:00,溫馨接送情,吳采璋

17:00~17:20,文教新聞,新聞組

17:20~17:30,教育交流道,洪秋玉

17:30~18:30, RFI 法廣電台華語新聞,法廣電台

18:30~19:00,德國之聲,德國之聲

19:00~19:30,韓語教學,林明德

19:30~20:00,俄語教學,馬邊野

20:00~20:30,華語教學(印尼語、泰國語、越南語),中央廣播

20:30~21:00,日語文法解析,林綺雲

21:00~21:30,空中英語教室,裴安琪

21:30~22:00,實用空中美語,空中美語

22:00~22:30,MAGIC ENGLISH,曾麗娜、呂佳珊

22:30~23:00,花 young 星空下,洪璘璘

23:00~23:10,文教新聞,新聞組

23:10~00:00,青春夢想家,蕭曼屏

PHP正則表達式 過濾html

    $contents = preg_replace("/\s+/", " ", $contents); //過濾多餘回車
    $contents=preg_replace("/<[ ]+/si","<",$contents); //過濾<__("<"號後面帶空格) 
$contents=preg_replace("/<\!--.*?-->/si","",$contents); //註釋   
$contents=preg_replace("/<(\!.*?)>/si","",$contents); //過濾DOCTYPE   
$contents=preg_replace("/<(\/?html.*?)>/si","",$contents); //過濾html標籤   
$contents=preg_replace("/<(\/?meta.*?)>/si","",$contents); //過濾meta標籤    
$contents=preg_replace("/<(\/?body.*?)>/si","",$contents); //過濾body標籤   
$contents=preg_replace("/<(\/?link.*?)>/si","",$contents); //過濾link標籤   
$contents=preg_replace("/<(\/?form.*?)>/si","",$contents); //過濾form標籤 
$contents=preg_replace("/cookie/si","COOKIE",$contents); //過濾COOKIE標籤   
$contents=preg_replace("/<(applet.*?)>(.*?)<(\/applet.*?)>/si","",$contents); //過濾applet標籤   
$contents=preg_replace("/<(\/?applet.*?)>/si","",$contents); //過濾applet標籤 
$contents=preg_replace("/<(style.*?)>(.*?)<(\/style.*?)>/si","",$contents); //過濾style標籤   
$contents=preg_replace("/<(\/?style.*?)>/si","",$contents); //過濾style標籤  
$contents=preg_replace("/<(title.*?)>(.*?)<(\/title.*?)>/si","",$contents); //過濾title標籤   
$contents=preg_replace("/<(\/?title.*?)>/si","",$contents); //過濾title標籤  
$contents=preg_replace("/<(object.*?)>(.*?)<(\/object.*?)>/si","",$contents); //過濾object標籤   
$contents=preg_replace("/<(\/?objec.*?)>/si","",$contents); //過濾object標籤     
$contents=preg_replace("/<(noframes.*?)>(.*?)<(\/noframes.*?)>/si","",$contents); //過濾noframes標籤   
$contents=preg_replace("/<(\/?noframes.*?)>/si","",$contents); //過濾noframes標籤   
$contents=preg_replace("/<(i?frame.*?)>(.*?)<(\/i?frame.*?)>/si","",$contents); //過濾frame標籤   
$contents=preg_replace("/<(\/?i?frame.*?)>/si","",$contents); //過濾frame標籤   
$contents=preg_replace("/<(script.*?)>(.*?)<(\/script.*?)>/si","",$contents); //過濾script標籤   
$contents=preg_replace("/<(\/?script.*?)>/si","",$contents); //過濾script標籤   
$contents=preg_replace("/javascript/si","Javascript",$contents); //過濾script標籤   
$contents=preg_replace("/vbscript/si","Vbscript",$contents); //過濾script標籤   
$contents=preg_replace("/on([az]+)\s*=/si","On\\1=",$contents); //過濾script標籤   
$contents=preg_replace("/&#/si","&#",$contents); //過濾script標籤,如javAsCript:alert('aabb)   
$contents=preg_replace("/<(\/?table.*?)>/si","",$contents); //過濾table標籤  
$contents=preg_replace("/<(\/?tr.*?)>/si","",$contents); //過濾tr標籤  
$contents=preg_replace("/<(\/?tbody.*?)>/si","",$contents); //過濾tbody標籤  
$contents=preg_replace("/<(\/?td.*?)>/si",",",$contents); //過濾td標籤 

$contents=preg_replace("/<(\/?img.*?)>/si","",$contents); //過濾img標籤  
$contents=preg_replace("/<(\/?input.*?)>/si","",$contents); //過濾input標籤  

$contents=preg_replace("/<(\/?font.*?)>/si","",$contents); //過濾font標籤
$contents=preg_replace("/<(\/?th.*?)>/si","",$contents); //過濾th標籤

$contents=preg_replace("/<(head.*?)>(.*?)<(\/head.*?)>/si","",$contents); //過濾head標籤  

$contents=preg_replace("/<(select.*?)>(.*?)<(\/select.*?)>/si","",$contents); //過濾select標籤   

$contents=preg_replace("/<(strong.*?)>(.*?)<(\/strong.*?)>/si","",$contents); //過濾strong標籤  

$contents=preg_replace("/<(label.*?)>(.*?)<(\/label.*?)>/si","",$contents); //過濾label標籤   

$contents=preg_replace("/<(a.*?)>(.*?)<(\/a.*?)>/si","",$contents); //過濾a標籤   

ie 條件式註解,Conditional Comments [if IE]

<!--[if IE]>
<p>您正在使用的瀏覽器為 ie 。</p>
<![endif]-->


<!--[if IE 6]>
<p>您正在使用的瀏覽器為 ie6 。</p>
<![endif]-->


<!--[if IE 7]>
<p>您正在使用的瀏覽器為 ie7 。</p>
<![endif]-->


<!--[if lt IE 7]>
<p>您正在使用的瀏覽器為比 ie7 較舊的版本。</p>
<![endif]-->


<!--[if gte IE 8]>
<p>您正在使用的瀏覽器為 ie8 或比 ie8 更新的版本。</p>
<![endif]-->


<!--[if !IE]>-->
<p>您正在使用的瀏覽器不是 ie 。</p>
<!--<![endif]-->


<!--[if !(IE 6)]>
<p>您正在使用的瀏覽器為 ie ,但不是 ie6 。</p>
<![endif]-->


<!--[if (gte IE 5.5)&(lt IE 7)]>
<p>您正在使用的瀏覽器為 ie5.5 或 ie6 。</p>
<![endif]-->


<!--[if (IE 7)|(IE 6)]>
<p>您正在使用的瀏覽器為 ie7 或 ie6 。</p>
<![endif]-->


<!--[if gte IE 7]><!-->
<p>您正在使用的瀏覽器為 ie7 或比 ie7 更新的版本,或不是使用 ie 。</p>
<!--<![endif]—>



 



 



http://boohover.pixnet.net/blog/post/12309095

Javascript撥放和停止的按鈕

下面有一段Javascript撥放和停止的按鈕:

<embed src="example/javascript/newyear5.mid" hidden="true" name="midi">
<a href="javascript:document.midi.play()" target=_self>撥放音樂</a>
<a href="javascript:document.midi.stop()" target=_self>停止音樂</a>

document.midi.play(),javascript:代表這個不是連結而是Javascript語法,document代表這個網頁,midi就是剛剛我們設定的name,play()就是撥放的意思,了乎﹖就是這麼容易,按下以後就會讓本網頁的name為midi的多媒體物件開始撥放。
document.midi.stop(),略。