Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
For Test
val string = ""
val pattern = ".*/(([A-Z]+_)*ID$)".r
//val string = "bankId=1&accountId=2&transactionId=3"
//val pattern = "bankId=(.+)&accountId=(.+)&transactionId=(.+)".r
string match {
case pattern(a,b) => println(a,b) //matched group(1) assigned to variable a483
case _ => println("nothing")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment