Search code examples
pythonregexsql-parser

Regex that remove painting logic and just keep the column name


I have below String and I want to remove formatting and keep just column name. Can someone suggest regex for this please?

"XYZ_Col,to_timestamp(CREATE_DT,'yyyyMMdd HHmmss')CREATE_DT,ABC_Col,DEF_Col"

to

"XYZ_Col,CREATE_DT,ABC_Col,DEF_Col"

Thanks in advance


Solution

  • I got the solution.

    regexp_extract(regexp_replace(column_name, \"\'\", \"\\\\''\") , '[^)]*$',0)