Python code to Remove backlashed Single quote ‘ within a big double quoted string that has multiple single quotes and within that single quotes we have backlashed single quotes.
Input:
"INSERT INTO `a3c_parser_events_log` VALUES (1222,'A2540','AUDI','AP1','error','ERROR frontend_clang: invalid line marker flag '2' : cannot pop empty include stack , ','2023-05-11 10:19:33.724334','USER3'), (1279,'A2566','Nikola','ALL','error','ERROR frontend_clang: 'C:\Users\USER1\Documents\EXECUTION\PATH\TO\FOLDER\SOMETHING\FOLDER' file not found , ','2023-05-19 14:17:47.188004','USER1');"
Output should be
Output:
"INSERT INTO `a3c_parser_events_log` VALUES (1222,'A2540','ERROR frontend_clang: invalid line marker flag 2 : cannot pop empty include stack , ','2023-05-11 10:19:33.724334','USER3'), (1279,'A2566','ERROR frontend_clang: C:\Users\USER1\Documents\EXECUTION\PATH\TO\FOLDER\SOMETHING\FOLDER file not found , ','2023-05-19 14:17:47.188004','USER1');"
I tried the below code and it isn’t working
import re
def replace_quotes(text):
# Use regular expression to find and replace the pattern 'text' with "text"
return text.replace("\'", "")