Created
March 12, 2012 11:46
-
-
Save KitaitiMakoto/2021351 to your computer and use it in GitHub Desktop.
正規表現の中で名前付きグループの後方参照 ref: http://qiita.com/items/3144
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 文字列からクォートのペアを取り除く | |
re = /(?<quote>['"])(?<body>[^'"]*)\k<quote>/ | |
puts "These are 'quotes'".gsub(re, '\k<body>') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment