Re: regex pointer...

From: Date: Fri, 18 Oct 2002 01:58:22 +0000
Subject: Re: regex pointer...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-120453@lists.php.net to get a copy of this message
preg_match_all('/<a\s*href="(.*)">(.*)<\/a>/imU', $text, $matched); $matched[1] is filled with all the URLs $matched[2] is filled with all the text for the link. -js Kelly Meeks wrote:
Ok, I'm just learning about regular expression, and I'm a little lost. I've ordered the O'Reilly book on regex, but I have an immediate need to do the following: I've got a bunch of links, and I need to get the words that are acting as the link out of the href tag ex: <a href="thelink.html">the text I need</a> Can this be down with regular expressions? I think it can, but I can't seem to get it right. Thanks in advance. Kelly


« previous php.general (#120453) next »