Skip to content

Instantly share code, notes, and snippets.

@yllan
Created November 17, 2012 13:02
Show Gist options
  • Select an option

  • Save yllan/4095822 to your computer and use it in GitHub Desktop.

Select an option

Save yllan/4095822 to your computer and use it in GitHub Desktop.
scala regex replace with function transformation
scala> """\{(\d+)\}""".r.replaceAllIn("""{123} {ABC} {45}""", m=>(m.group(1).toInt + 1).toString)
res1: String = 124 {ABC} 46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment