Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
REGEX for SPT
Message
From
13/06/2008 21:22:41
Mike Yearwood
Toronto, Ontario, Canada
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
REGEX for SPT
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
MS SQL Server
Miscellaneous
Thread ID:
01324051
Message ID:
01324051
Views:
56
Hey all

Garrett Fitzgerald made a suggestion to clean up SQL enclosed in TEXT...ENDTEXT. He did it with a combination strtrans and a final RegExp. I asked if it could not be done with a single regex, but haven't heard back.

This was his example:

>>TEXT TO lcQueryFormat NOSHOW
>> SELECT Person.searchName, Person.patientId, Person.dateOfBirth ;
>> SNIP ;
>> FROM ml.Person Person ;
>> SNIP ;
>> LEFT JOIN ml.Problem ON Person.pID = Problem.pID ;
>> AND (Problem.code LIKE 'ICD-578.9%' ; && GI bleeding &&
>> OR Problem.code LIKE 'ICD-599.7%' ; && Hematuria &&
>> OR Problem.code LIKE 'ICD-924.9%' ; && Hematoma &&
>> OR Problem.code LIKE 'ICD-432.9%' ; && Intracranial hemorrhage &&
>> OR Problem.code LIKE 'ICD-287.9%' ; && Bleeding disorder &&
>> )
>> ENDTEXT
>>
>> lcQueryFormat = CHRTRAN(lcQueryFormat, ";", "")
>>
>> lcQuery = CHRTRAN(lcQueryFormat ;
>> , CHR(9) + CHR(10) + CHR(13) ;
>> , " ")
>> lcComment = "&" + "&" && For obvious reasons...
>> lcQuery = RegExp(lcQuery, lcComment + "[^&]+" + lcComment, 1, "")

Can the CHRTRANs and the stuff from the first && to the end of the line, be stripped with a single regexp call?
Thanks
Reply
Map
View

Click here to load this message in the networking platform