Expression régulière: trouver le texte entre deux balises HTML

Author:


Download

<html>
<head>
<title>Expression régulière</title>
</head>
<body>
<?php

$texte = "Test: <strong>Bienvenu sur mon site</strong><p>à ignorer</p>";
ereg('<strong>(([^<"]|[^<]*<[^/][^<])*("[^"]*"([^<"]|[^<]*<[^/][^<])*)*)?</strong>', $texte, $matches);
echo "Résultat<br/>: " . $matches[1];
?>

</body>
</html>

Leave a Reply

Your email address will not be published. Required fields are marked *


× two = 2