Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parsing out parts of text file
Message
From
04/02/2008 02:05:42
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01288936
Message ID:
01288943
Views:
11
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.
Previous
Reply
Map
View

Click here to load this message in the networking platform