preg_match and regular expression
| From: | fred | Date: | Mon, 08 Dec 2003 09:39:35 +0000 |
| Subject: | preg_match and regular expression | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-172172@lists.php.net to get a copy of this message | ||
Hi
I have problems with a regular expression.
I have a html file like this:
....
<body>
<div>Hello</div>
<br>
<br>
<div>somthing</div>
<br>
</body>
....
And i want to use preg_match to get a list of all the <div> tags in the
file:
result:
$list[0] = <div>Hello</div>
$list[1] = <div>somthing</div>
I have tryed this:
preg_match('/.*(\<div\>.*\<\/div\>).*/', $contents, $list);