A small library that allows interpolation of regex capture groups in match
statements.
The nth interpolant (e.g. $group1
) will match against the nth capture group in the regex.
import dev.bgahagan.regex.intrpl._
"hello world" match {
case r"(\w+)$group1 (\w+)$group2" =>
println(group2)
}
Outputs:
world
- The regex is parsed and compiled on each
match
invocation.