Last active
June 28, 2017 19:46
-
-
Save kaja47/4dbb3018cbd7dfbfc011dfa67c54dc60 to your computer and use it in GitHub Desktop.
scala.util.matching.Regex.replaceAll
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
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