I need to replace some PHP script with a form like this:
the original text:
mysql_query ("UPDATE table SET fill = '$_POST[aaa]' WHERE id = '1'");
mysql_query ("UPDATE table SET fill = '$_POST[bbb]' WHERE id = '2'");
mysql_query ("UPDATE table SET fill = '$_POST[ccc]' WHERE id = '3'");
mysql_query ("UPDATE table SET fill = '$_POST[ddd]' WHERE id = '4'");
mysql_query ("UPDATE table SET fill = '$_POST[eee]' WHERE id = '5'");
changed to:
mysql_query ("UPDATE table SET fill = '$aaa' WHERE id = '1'");
mysql_query ("UPDATE table SET fill = '$bbb' WHERE id = '2'");
mysql_query ("UPDATE table SET fill = '$ccc' WHERE id = '3'");
mysql_query ("UPDATE table SET fill = '$ddd' WHERE id = '4'");
mysql_query ("UPDATE table SET fill = '$eee' WHERE id = '5'");
how to replace the entire text at once? I use Notepad ++ as my text editor. Thank you very much.
You can use it's regular expression Find-Replace features... A pattern like so
\_POST\[(.*)\]
(add global match modifier like /g if need)
and replacing it with only
$1
will work. here https://regex101.com/r/vC8tW7/1 a working demo.