As far as I can see from the documents, groups not related to capture are defined (:?), As in Java. (I believe this is the same base library).
However, this does not work:
var R = "a(:?b)c".r R.findFirstMatchIn("abc").get.group(1)
returns "b" (when it should be empty). I suspect this is usually not a problem, but when performing pattern matching, this means that I cannot do it now:
"abc" match {case R => println("ok");case _ => println("not ok")} > not ok
I need to do:
"abc" match {case R(x) => println("ok");case _ => println("not ok")} > ok
Is there any way to make this work "as expected"?
source share