Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
For Test
val string = "https://demo.openbankproject.com/obp/v4.0.0/config/obp/v4.0.0/dynamic/pet/PET_ID/PET_A_ID"
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