I have a string:
const str = 'DELETE FROM "organization" WHERE "name" = $1 AND "metadata" = $2 AND "id" = $3';
I need to find "metadata" word to modify it. I only know that there is = $2 after "metadata" word.
const regex = RegExp(/ = $2/); // just to show what I have
const foundWord = someMagicWithRegex(str, regex); // "metadata"
const newString = str.replace(foundWord, `${foundWord}::text`);
console.log(newString);
'DELETE FROM "organization" WHERE "name" = $1 AND "metadata"::text = $2 AND "id" = $3'
How regex should look? (if its possible)