在搜尋/取代模式下
點選下圖紅框處,即可使用regex模式
如果想要保留match pattern內容
在Replace With這欄如上圖使用錢號+數字即可
如果有一段內容如下:
$a = 1;
$b = 2;
照圖中使用的Replace pattern
就會變成如下:
$a = '1';
$b = '2';
Leave a commentPS:
- 錢號是特殊符號,所以要當作純文字的話要加反斜線。
- 使用 $1 或是 \1 在 Sublime Text 中兩者皆具有保留 match pattern 的效果。