<html>
<body>
<%
Dim texte, resultat
Function recherche(modele, chaine)
Dim objet
Dim correspondance
Dim collection
Set objet = New RegExp
objet.Pattern = modele
objet.IgnoreCase = True
objet.Global = True
Set collection = objet.Execute(chaine)
For Each correspondance in collection
resultat = resultat & "<tr><td>" & correspondance.FirstIndex _
& "</td><td>" & correspondance.Value & "</td></tr>"
Next
recherche = resultat
End Function
texte = "Le chercheur d'opale a trouvé une belle pierre dans " _
& "une galerie sinistre, pour le plus grand bonheur de " _
& "la population occidentale qui pourtant se désolerait " _
& " de travailler dans de telles conditions inhumaines."
resultat = recherche(_
"\b[a-zA-Zàâäéèêëïîôöùûç]*le[a-zA-Zàâäéèêëïîôöùûç]*\b",_
texte)
Response.Write "<h3>Liste des mots contenant la " _
& "chaîne de caractères <I>le</I></h3>" _
& "<h4>Texte</h4><p>" & texte & "</p>" _
& "<table border='1' cellpadding='3'>" _
& "<tr><th>Position</th><th>Mot</th></tr>" _
& resultat & "</table>"
%>
</body>
</html> |