Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parsing out parts of text file
Message
 
To
04/02/2008 01:21:47
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01288936
Message ID:
01288941
Views:
13
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,"")
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform