Re: Little regex help please...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey Todd, Eric,

Thanks for replying.

> I don't believe you need both the / and the # for delimiters in your
> RegEx. Try using just # (since / is actually going to be in the text
> you're searching for) like this:
>
> <?php
>  $data =
> file_get_contents("http://www.youtube.com/watch?v=oQ2dKXGAjNg";);
>  preg_match('#<title>([^<]*)</title>#iU', $data, $match);
>  $title = $match[1];
>  echo $title;
> ?>
>
>

> You can also escape the / like \/.


Ok, I changed it to:
<?php
$data = file_get_contents("http://www.youtube.com/watch?v=oQ2dKXGAjNg";);
preg_match('/#<title>([^<]*)<\/title>#iU',$data,$match);
$title=$match[1]; 
echo $title;
?>
And this is the error i am getting:

Warning:  preg_match() [function.preg-match]: No ending delimiter '/' found in C:\wamp\www\ezee\tests\get_remote_title.php on line 3



      

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux