S
S
sorry_i_noob2018-08-29 20:08:24
phpstorm
sorry_i_noob, 2018-08-29 20:08:24

PHPStorm - how to search and replace with a regular expression?

In PHPStorm Ctrl+Shift+H, I press , I press the checkmark Regex, and in the first line (search line) I enter this:
->render_ajax\([^,]*, false
In the second:
->render_ajax\([^,]*, Ajax::STATUS_UNSUCCESS
I press Replace in Find Window - All Files
And PHPStorm replaces, for example, this:
$this->render_ajax($message, false)
Here with this:

return $this->render_ajax([^,]*, Ajax::STATUS_SUCCESS);

And how can I make it so that it leaves the result of the regular expression, and changes only what is not included in it? To make it look like this:
return $this->render_ajax($message, Ajax::STATUS_SUCCESS);

Is this possible with PHPStorm? Or some other ones?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2018-08-29
@sorry_i_noob

(->render_ajax\([^,]*), false
$1, Ajax::STATUS_UNSUCCESS

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question