Hi,
I want to replace the equal signs in a SQL query string with "like" if the word following an equal sign ends in the SQL wildcard character "%".
So:
select * from addresses where lastname = "sm%" and firstname = "k%" and city = "london"
should turn into
select * from addresses where lastname like "sm%" and firstname like "k%" and city = "london"
What is an elegant way to achieve this in Transcript?
TIA,
Kai
Newbie: Chunks..reg. expressions?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 179
- Joined: Sat Apr 08, 2006 11:08 pm
- Contact:
Re: Newbie: Chunks..reg. expressions?
Off the top of my head:
Best,
Mark
Code: Select all
repeat with n = 1 to the number of words in tQuery
if word n of tQuery is "=" AND char - 2 of word n+1 of tQuery is "%" then put "like" into word n of tQuery
end repeat
Mark