GHRake
05-18-2016, 10:49 PM
Hello people of vbulletin, I've decided it's time to learn some php and write a vbulletin plugin.
So far so good:
https://images-1.discordapp.net/eyJ1cmwiOiJodHRwOi8vaS5pbWd1ci5jb20vckN0cWN6ay5wbm cifQ.bNvhAZoiLigHDhljt4R9i81gcAI.png
But I'm having trouble with getting a rexexp to work with preg_match_all()
I'm getting the dreaded
"PHP Warning: preg_match_all(): Delimiter must not be alphanumeric or backslash"
When I use:
if (stripos($string, 'youtu') !== false)
{
$regex = 'https?:\/\/((.+\.youtube\.com\/watch\?v=)|(youtu\.be\/))([a-zA-Z0-9-_]+)';
preg_match_all($regex, $string, $matches);
if (!empty($matches))
{
$og_array['og:video'] = $matches[2][0];
}
}
Any words of wisdom? TIA
So far so good:
https://images-1.discordapp.net/eyJ1cmwiOiJodHRwOi8vaS5pbWd1ci5jb20vckN0cWN6ay5wbm cifQ.bNvhAZoiLigHDhljt4R9i81gcAI.png
But I'm having trouble with getting a rexexp to work with preg_match_all()
I'm getting the dreaded
"PHP Warning: preg_match_all(): Delimiter must not be alphanumeric or backslash"
When I use:
if (stripos($string, 'youtu') !== false)
{
$regex = 'https?:\/\/((.+\.youtube\.com\/watch\?v=)|(youtu\.be\/))([a-zA-Z0-9-_]+)';
preg_match_all($regex, $string, $matches);
if (!empty($matches))
{
$og_array['og:video'] = $matches[2][0];
}
}
Any words of wisdom? TIA