Skip to content

Instantly share code, notes, and snippets.

@kaja47
Last active June 28, 2017 19:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaja47/4dbb3018cbd7dfbfc011dfa67c54dc60 to your computer and use it in GitHub Desktop.
Save kaja47/4dbb3018cbd7dfbfc011dfa67c54dc60 to your computer and use it in GitHub Desktop.
scala.util.matching.Regex.replaceAll
val matchAll = new Regex(".*")
matchAll.replaceAllIn("I have no money", m => m.matched)
// I have no money
matchAll.replaceAllIn("I have $0", m => m.matched)
// I have I have $0
matchAll.replaceAllIn("I have $1", m => m.matched)
// java.lang.IndexOutOfBoundsException: No group 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment