--- saravanan <[EMAIL PROTECTED]> wrote:

> I have get the value in the src attribute of img tag using regular
> expression.
> 
> For eg:
>     I have <img src="http://somehodt.com/images/iamge1.jpg";>.how to get
> only http://somehodt.com/images/iamge1.jpg
>       
> Expecting a reply from u
>       
> Regards,
> saravanan

The Perl-compatable regular expression (used in preg* functions) could be
something like this:

$regex = "/<img.+src="?(.+)"?.*>/is";

To extract just the src use preg_match()

if (preg_match($regex, $html, $matches))
{
 $src = $matches[1];
}
else
{
 print "No match found."
}

James
_____


James D. Keeline
http://www.Keeline.com  http://www.Keeline.com/articles
http://Stratemeyer.org  http://www.Keeline.com/TSCollection

http://www.ITeachPHP.com -- Free Computer Classes: Linux, PHP, etc.
Summer Semester Begins Jun 20 -- New Classes Start Every Few Weeks.


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/HKFolB/TM
--------------------------------------------------------------------~-> 

Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to