LoginSignup
28
23

More than 5 years have passed since last update.

Atomで正規表現の後方参照を使った置換

Last updated at Posted at 2015-04-29

よく忘れるのでメモ。

下記のような文書の単語の前後に記号を挿入したい。

Apple
Banana

Atomでは$1などが後方参照。

untitled_-__Users_yandod_develop_php-warrior_-_Atom_と_正規表現に関する140件の投稿_-_Qiita.png

上記の様に記述して実行すれば次のような出力を得る。

-Apple-
-Banana-

memo

RubyからPHPへ

^([a-zA-Z_]+) ([0-9a-zA-Z_":\. ,?'\!]+)
$this->$1($2);
28
23
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
28
23