On Tue, 30 Apr 2002, Lazor, Ed wrote:
> <ul><li><a href="http:\\www.someaddress.com">SomeSite</a> This is a
> description of the site.</ul>
> I'm trying to parse out the address, site name, and description into
> separate variables.  How can I do this?

I assume you mean http:// and not http:\\.

  $str = '<ul><li><a href="http://www.someaddress.com";>SomeSite</a> This is a 
description of the site.</ul>';
  preg_match('/href="(\S+)">(.+?)<\/a>(.+?)<\/ul>/', $str, $matches);

  print "Address: {$matches[1]}<br>Site: {$matches[2]}<br>Description:{$matches[3]}";

It's all laid out on the preg pages in the manual.


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

Reply via email to