28
23

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?