Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parsing out parts of text file
Message
From
04/02/2008 04:36:33
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01288936
Message ID:
01288952
Views:
11
>>I also saw Craig's demonstartions in Phoenix last October, and was very impessed. The drawback is the learning curve and the total lack of readability. The expressions easily become pretty complex.
>
>I agree that the expressions can get complex. Having a tool to test your expressions is a must! The one Craig supplied at SWFox is good and I use a program called RegEx Buddy.
>
>But if you compare to just the STREXTRACT function, the Regular Expression equivelant is really simple:
>
STREXTRACT("<img",">")
>** vs **
>.Pattern = "<img.*?>"
>
>If you get anymore complex than that with a Regualar Expression, your VFP code equivilant is going to get just as, if not more complex.
>
>For example...the code above will find any tag that starts with img, including img, imgone, imgtwo, etc... Now that is probably not a big deal for the img tag, but imagine trying to find all the tags. You are going to find every tag that starts with an "a", including . How complex would your VFP code have to be to find the "a" tags, without finding the "area" tags, considering that the "a" tag can contain tabs, spaces and carriage returns within the tag. For a Regular Expression it is a simple as
>
>
.Pattern = "<a\s+.*?>"
>
>I think the learning curve is worth it if you need to do any heavy string manipulation and it doesn't take long to figure out the basics.

If the expresion is as simple as you write, then RexEx is the natural choice. I guess Craig scared me a little when he, at the end of hissession, showed the official expression to evaluate email addresses. :-)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform