I would like to have a regular expression that convert below string to the "where" clause in sql.
For example:
/* Col1: ABC, Col2: 123, ColN: Bla bla... */
to:
WHERE Col1 = 'ABC' AND Col2 = '123' AND ColN = 'Bla Bla...'
If this is something that feasible?
2
Answers
We could use a regex replacement here:
You could use this regex:
to match the individual components of the input:
/*
,,
,col: value
and*/
and replace them with the appropriate values:WHERE
,AND
,col = 'value'
and''
using a replacer function: