Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parsing out parts of text file
Message
De
04/02/2008 02:05:42
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01288936
Message ID:
01288943
Vues:
12
Thanks Bo. I did use Hugo's solution but will keep this one on file too.

>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,"")
>
In the End, we will remember not the words of our enemies, but the silence of our friends - Martin Luther King, Jr.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform