Reputation: 9890
How can i replace
$lang['abc'] with lang('abc')
and
{$lang['abc']} with ".lang('abc')."
including quotes.
Where i am stuck is how RegExp can save 'abc'
to be used in replaced text
Upvotes: 1
Views: 106
Reputation: 41838
First one (tested in N++):
Search: \$lang\['(abc)'\]
Replace: lang\('$1'\)
Second one (also tested in N++):
Search: \{\$lang\['(abc)'\]\}
Replace: ".lang\('$1'\)."
The back reference mentioned by devnull is the content of the (abc) parentheses. The parentheses capture abc into Group 1. That content is referred to in the replacement as "$1". You may like to read all about regex capture.
Upvotes: 2