Mike Yearwood
Toronto, Ontario, Canada
Information générale
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement