正则表达式帮助 - 将视频代码转换为wordpress短标签

时间:2010-04-23 15:09:12

标签: regex wordpress

我正在尝试将camtasia html / javascript视频嵌入代码转换为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]

谢谢!

2 个答案:

答案 0 :(得分:0)

/SWFObject\( "(.+?)"/

\1将包含网址,这似乎是您尝试从主题中提取的唯一内容。

答案 1 :(得分:0)

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