Re: Match for titles using pregexp

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

 



On Thu, 2007-12-27 at 11:27 +0300, OOzy Pal wrote:
> more words/chars[<a href="#c_1" id="ids_1"  title="Hello">2</a>]more words/chars
> 
> How can I match for the title. In this case the word Hello using regexp?

<?php

$text = 'more words/chars[<a href="#c_1" id="ids_1"
title="Hello">2</a>]more words/chars';

$title = null;
if( preg_match( '/title="([^"]*)"/Umi', $text, $bits ) )
{
    $title = $bits[1];
}
 
echo 'Title: '.$title."\n";

?>

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

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