Skip to content

Instantly share code, notes, and snippets.

@kijuky
Created June 19, 2016 08:58
Show Gist options
  • Save kijuky/449fdfcb52d3061abc75c1a54fa2c0bc to your computer and use it in GitHub Desktop.
Save kijuky/449fdfcb52d3061abc75c1a54fa2c0bc to your computer and use it in GitHub Desktop.
ネストしたカッコの一番内側を取る
scala> val str = "ab$(cd$(ef)gh)ij"
str: String = ab$(cd$(ef)gh)ij
scala> new scala.util.matching.Regex("""\)([^\)]*?)\(\$""").findFirstIn(str.reverse).get.reverse
res0: String = $(ef)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment