MyBB Community Forums

Full Version: SOLVED - Custom Mycode matching returning more than one variable
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've created a custom mycode that uses the JW FLV Player ( http://www.longtailvideo.com/players/jw-flv-player/ ) to embed flv videos, and it works great. However, now I'd like to be able to pass the width and height as variables, and can't figure out the regex necessary to do so. What I have so far is matching:

\[video\](.*?)\[/video\]

and replace with:

<script type='text/javascript' src='/videos/swfobject.js'></script>
<script type='text/javascript'>
var s1 = new SWFObject('/videos/player.swf','player','400','300','9');
s1.addParam('allowfullscreen','true');
s1.addParam('allowscriptaccess','always');
s1.addParam('flashvars','file=/videos/$1');
s1.write('preview');
</script>

I'd like to end up with something that matches [video width=640 height=480]URL[/video], and pass both variables. How do I do this?

Thanks.

After doing some more research, I stumbled across the solution, in case anyone else is interested: any place you put (*.?) in the match string becomes a variable in the replace string.