0
0

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 3 years have passed since last update.

正規表現 後方参照をするメソッド

Posted at

Image from Gyazo

こんなかんじで住所の部分に郵便番号が入るんだけど
Image from Gyazo

こんなかんじにしたかった。

開発環境

ruby 2.6.5
Ruby on Rails 5.2.5

本題

正規表現の後方参照をするメソッドが使える

これを参考にして

li.list-group-item = worship.shinto.address.match(/)/).post_match

こんなふうに post_match メソッドを使うと
)の後の文字が切り取れる

0
0
0

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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?