I have an encoded string with the syntax
"encodedProp:encodedValue OPERATOR encodedProp1:encodedValue1"
(the OPERATOR might be AND, OR, NOT, and there are N pairs prop:value).
The "encodedProp", "encodedValue", "encodedProp1", "encodedValue1" … are the encoded strings.
I’d like to use a regular expression to replace the ":" by " = ". Also, the part on the left side of ":" should be replaced by "\"" + left_part + "\"", the right part should be replaced by "'" + right_part + "'".
With the above example, the string after replacing should be:
"\"encodedProp\" = 'encodedValue' OPERATOR \"encodedProp1\" = 'encodedValue1'"
What is the expression I have to use to do this?
OK, I’m going out on a limb here because the problem is not well-defined, but let’s give it a try.
This completely ignores the
OPERATORpart – it simply looks for sequences of characters that include one colon, and wraps them in single/double quotes, replacing the colon along the way.