Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parsing out parts of text file
Message
 
À
04/02/2008 01:21:47
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01288936
Message ID:
01288941
Vues:
14
This message has been marked as a message which has helped to the initial question of the thread.
Hi Jos,

Regular Expressions make an easy job of it
LOCAL oRegEx AS VBScript.RegExp
LOCAL lcExp

** Sample text
TEXT TO lcExp NOSHOW TEXTMERGE
<html>
<body>
Hello this is a <img
src="sdsdsd">
test <img src="wewewe" class="all" border="0">
of the image <IMG SRC="apple"> tag parser
</body>
</html>
ENDTEXT

CLEAR

oRegEx=CREATEOBJECT("VBScript.RegExp")
oRegEx.Multiline= .F.
oRegEx.IgnoreCase = .T.
oRegEx.Global= .T.
** Pattern to match
oRegEx.Pattern = "<img\s+.*?>"

** How many matches
?"Matches: ", oRegEx.Execute(lcexp).Count

** Replaces matches with blank
?"Replace: "
?oRegEx.Replace(lcExp,"")
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform