Log in

View Full Version : What am I doing wrong?



Decode
25-09-2008, 03:54 PM
I'm trying to detect if a Youtube video is valid, but they are all invalid :( I can't work out what's wrong with the preg_match.



else if( !preg_match( "/http:\/\/(.*)youtube(.*)\/watch?v=(.*)/", $yturl ) ) {
echo "<div class=\"regerror\">Invalid Youtube URL</div>";
}

Agnostic Bear
26-09-2008, 12:22 PM
I'm trying to detect if a Youtube video is valid, but they are all invalid :( I can't work out what's wrong with the preg_match.



else if( !preg_match( "/http:\/\/(.*)youtube(.*)\/watch?v=(.*)/", $yturl ) ) {
echo "<div class=\"regerror\">Invalid Youtube URL</div>";
}



!preg_match( "/http:\/\/(.*?)youtube(.*?)\/watch?v=(.*?)/", $yturl )

Decode
26-09-2008, 03:20 PM
Thanks Jewish Bear :)

Want to hide these adverts? Register an account for free!