Regular Expressions
Posted: Tue Jul 16, 2002 6:43 pm
I an having trouble finding which reglar expression suits my needs.
I want to search through a web page a pull out all the links. Everything from the starting < a to the closing < / a >
ive been trying
The expression is not quite how i want it but i get an error if i change it. Since preg_match_all is a PCRE the syntax of the expression is different to normal reg ex's .
I want to search through a web page a pull out all the links. Everything from the starting < a to the closing < / a >
ive been trying
Code: Select all
preg_match_all("/(<a )(.*)(<\/a>)/i", $web_page, $matches);
for($i=0; $i< count($matchesї0]); $i++) {
echo( $matchesї0]ї$i]);
echo( $matchesї1]ї$i]);
}