> -----Original Message-----
> From: Ryan S [mailto:[EMAIL PROTECTED]
> Sent: Monday, October 13, 2008 11:33 AM
> To: php php
> Subject: [PHP] Little regex help please...
> 
> Hello!
> 
> Here's a regex that I got off the web that I am trying to modify for
my
> needs, I suck at regex so desperately need some help.
> 
> Basically, am trying to get a remote webpage and get the value between
> the <title> tags, note that it should get the values regardless if
> <title> is upper or lower case (case insensitive)
> 
> <?php
> $data =
> file_get_contents("http://www.youtube.com/watch?v=oQ2dKXGAjNg";);
> preg_match('/#<title>([^<]*)</title>#/iU',$data,$match);
> $title=$match[1];
> echo $title;
> ?>
> 
> This is the error that i am getting when running the above:
> 
> Warning: preg_match() [function.preg-match]: Unknown modifier 't' in
> C:\wamp\www\ezee\tests\get
> _remote_title.php on line 3

Ryan,

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;
?>

HTH,


Todd Boyd
Web Programmer

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

Reply via email to