Quote:
Originally Posted by Viper007Bond
Don't forget that the Google Video ID can be negative.
And I wasn't aware of Google.co.uk. I'll update and good thinking on the integer only. Thanks. 
|
I looked at this for another 10 mins and think that this should do the trick for both expressions:
PHP Code:
$viper_patterns = array(
'#\[youtube\]http://(www.youtube|youtube).com/watch\?v=([\w]+)(.*?)\[/youtube\]#si',
'#\[gvideo\]http://video\.google\.([^/]*?)/videoplay\?docid=([\d\-]+)(.*?)\[/gvideo\]#si',
);
$viper_replacements = array(
'[YOUTUBE]$2[/YOUTUBE]',
'[GVIDEO]$2[/GVIDEO]',
);
I spotted that if you preview a post the text in the editor window gets edited too which isn't ideal I guess. I wonder if there's a way of preventing that from happening?