Mike Yearwood
Toronto, Ontario, Canada
General information
Category:
Coding, syntax & commands
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only