Help us understand the problem. What is going on with this article?

正則表現 括弧でグループ

More than 1 year has passed since last update.

置換前
abc12fa
abc23fb
abc45fc
abc67fd
abc78fe
abc32ff

以下に変更したい(fの前gを追加したい)
abc12gfa
abc23gfb
abc45gfc
abc67gfd
abc78gfe
abc32gff

括弧でグループして、置換後は

$1→一番目の括弧

$2→二番目の括弧

$3→三番目の括弧(置換後に$3がなければ、置換対象、下図ようにgfに置換)

$4→四番目の括弧

image

syict001
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away