OSDir


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Replacing : with "${" at the beginning of the word and adding "}" at the end of the word


Hi,

if I have a string:

sql = """
where 1 = 1
and field = :value 
and field2 in (:list)
"""

I would like to replace every word that starts with ":" in the following way:
1. replace ":" with "${"
2. at the end of the word add "}"


An example should look like this:

where 1 = 1
and field = ${value}
and field2 in (${list})

How to do that?

Regards.