문제

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

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top