Jump to content

[SOLVED] preg match


ohdang888

Recommended Posts

i want to take the url, for example http://www.youtube.com/watch?v=j4HKdf6hzzLS, and just get the VIDEO ID from the submitted url...

 

i'm getting this error:

 

Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash in /home/ky4obama/public_html/fb_app/video_submitting.php on line 9

 

<?php
$post_url = mysql_real_escape_string(trim($_POST['url']));

if (preg_match('youtube.com/watch?v=(?<video>\w+)', $post_url, $url)) {
echo "WIDTH = ".$url['video'];
}else{
echo "no url found";
?>

Link to comment
https://forums.phpfreaks.com/topic/114855-solved-preg-match/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.