How can I build a regex example that can escape single quote and backslash in a given string for example using java?
input
an'ish&nath$
output
'an\'ish&nath$'
input
anish\nath\
ouput
'anish\\nath\\'
input
an\'ish&nath$
Output
'an\\\'ish&nath$'
How can I escape the single quote and backslash in between using regex?
You must use
\\\\'instead\\\'.