It's my first Python day, so please excuse me for this question
The Problem: in a file replace every occurrence of trim(column_name) with TRIM (TRIM (CHR (09) FROM column_name)). I've already sorted out how to do a pattern search and acquainted myself with the re.sub() function.
the pattern that matches my case is
p = re.compile ('trim\([a-z0-9_]+\)',re.I)
but how do I replace the matching pattern preserving the column name???
The needed output is, for example, as follows:
input: select trim(API12), trim(FIELD_CODE) from table
output: select TRIM (TRIM (CHR (09) FROM API12)), TRIM (TRIM (CHR (09) FROM FIELD_CODE)) from table