I'm using the following code for the plugin:
PHP Code:
$viper_patterns = array(
'#\[youtube\]http://(www.youtube|youtube).com/watch\?v=(.*?)&(.*?)\[/youtube\]#si',
'#\[youtube\]http://(www.youtube|youtube).com/watch\?v=(.*?)\[/youtube\]#si',
'#\[gvideo\]http://video\.google\.([^/]*?)/videoplay\?docid=(\d+)(.*?)\[/gvideo\]#si',
);
$viper_replacements = array(
'[YOUTUBE]$2[/YOUTUBE]',
'[YOUTUBE]$2[/YOUTUBE]',
'[GVIDEO]$2[/GVIDEO]',
);
$text = preg_replace($viper_patterns, $viper_replacements, $text);
The first change means that you can include content from local sites like video.google.co.uk, the second change (using \d+) is possible because the docid always seems to be an integer.