You can use capturing groups in Sublime Text 3 search and replace. Thus, you can capture the parameter and use the back-reference to refer to it in replaced text.
Capturing groups in regexp use the special parenthesis characters to "capture" matches and make them available in "back-references" $1
, $2
etc., which are like variables containing the matched group.
- Say we have a string:
SOMETHING_UNWANTEDMY_FIRST_CAPTURED_WORDSOMETHING_UNWANTEDMY_SECOND_CAPTURED_WORDSOMETHING_UNWANTED
- Find with regex:
SOMETHING_UNWANTED(MY_FIRST_CAPTURED_WORD)SOMETHING_UNWANTED(MY_SECOND_CAPTURED_WORD)SOMETHING_UNWANTED
- Replace using capture groups:
$1$2
- Result:
MY_FIRST_CAPTURED_WORDMY_SECOND_CAPTURED_WORD