2010-04-23 61 views
1

我試圖將camtasia html/javascript視頻嵌入代碼轉換爲wordpress流水遊戲短代碼。正則表達式幫助 - 將視頻代碼轉換爲wordpress短標記

原來的代碼如下:

<p>The Camtasia Studio video content presented here requires JavaScript to be enabled and the latest version of the Adobe Flash Player. If you are you using a browser with JavaScript disabled please enable it now. Otherwise, please update your version of the free Adobe Flash Player by <a href="http://www.adobe.com/go/getflashplayer">downloading here</a>. </p> 



var fo = new SWFObject("http://www.superaffiliatecoachingclub.com/sacconly/utl/modules/sitereviews/compucard/compucard_controller.swf", "csSwf", "640", "535", "8", "#FFFFFF"); 
fo.addVariable("csConfigFile", "http://www.superaffiliatecoachingclub.com/sacconly/utl/modules/sitereviews/compucard/compucard_config.xml"); 
fo.addVariable("csColor" , "FFFFFF"); 
fo.addVariable("csPreloader" , "http://www.superaffiliatecoachingclub.com/sacconly/utl/modules/sitereviews/compucard/compucard_preload.swf"); 
if(args.movie) 
{ 
fo.addVariable("csFilesetBookmark", args.movie); 
} 
fo.write("flashcontent"); 

我需要的輸出就像這樣:

[FLOWPLAYER=http://www.superaffiliatecoachingclub.com/sacconly/utl/modules/sitereviews/compucard/compucard_controller.swf,600,450] 

謝謝!

回答

0
preg_match('/SWFObject\("(.*?)", ".*?", "(\d+)", "(\d+)"/', $str, $match); 
$output = "[FLOWPLAYER={$match[1]},{$match[2]},{$match[3]}]"; 
0
/SWFObject\("(.+?)"/ 

\1將包含URL,似乎這就是你試圖從主題提取的唯一的事。