Replacing : with "${" at the beginning of the word and adding "}" at the end of the word
MRAB
python at mrabarnett.plus.com
Tue Oct 2 13:35:31 EDT 2018
On 2018-10-02 14:04, zljubisic at gmail.com wrote:
> I have to execute the same sql in two different programs.
> Each of them marks parameters differently.
>
> Anyway, I have found the solution.
>
> cnv_sel = re.sub(r"(:(.+?)\b)", r"${\2}", sel)
>
A slightly better solution would be:
cnv_sel = re.sub(r":(\w+)", r"${\1}", sel)
More information about the Python-list
mailing list