David Findlay David Findlay - 11 months ago 66
PHP Question

Can you use structural search and replace to remove function calls in PhpStorm?

I've got some old PHP code I'm refactoring. I'm changing from using old style escaping to using prepared statements. So I'm looking to get rid of stuff like this:

$ath_no = mysql_real_escape_string($csvEntry[1]);

Changed to:

$ath_no = $csvEntry[1];

I know I could use standard replace, but it wouldn't get rid of the close bracket.

Can I use PhpStorms' structural search and replace for this and how?

Answer Source

PHPStorm allows you to use regular expressions in find & replace.

You can this regular expression:


And the replacement should be: