When I test this regex: \(\(([^)]*)\)\),?\s*
against this string:
((1.1 1.2, 1.3 1.4)), ((2.1 2.2, 2.3 2.4, 2.5 2.6))
in RegexBuddy I get these matches:
* Match 1: ((1.1 1.2, 1.3 1.4)),
Group 1: 1.1 1.2, 1.3 1.4
* Match 2: ((2.1 2.2, 2.3 2.4, 2.5 2.6))
Group 1: 2.1 2.2, 2.3 2.4, 2.5 2.6
When in Scala I try:
val rx = """\(\(([^)]*)\)\),?\s""".r
val s = "((1.1 1.2, 1.3 1.4)), ((2.1 2.2, 2.3 2.4, 2.5 2.6))"
val a = s match {
case rx(x) => "matches"
case _ => "does not match"
}
val b = rx.findAllMatches(s)
// a is "does not match"
// b is List("((1.1 1.2, 1.3 1.4)), ", "((2.1 2.2, 2.3 2.4, 2.5 2.6))")
Is there a way, on the line with rx(x)
above, that I could have gotten the multiple matches that fillAllMatches
was able to give me?