Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
REGEX for SPT
Message
De
13/06/2008 21:22:41
Mike Yearwood
Toronto, Ontario, Canada
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
REGEX for SPT
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Database:
MS SQL Server
Divers
Thread ID:
01324051
Message ID:
01324051
Vues:
57
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
Répondre
Fil
Voir

Click here to load this message in the networking platform