public
Created

  • Download Gist
match.scala
Scala
1 2 3 4 5 6 7 8 9 10 11
scala> val r = """(^foo.*)""".r
r: scala.util.matching.Regex = (^foo.*)
 
scala> val s = "foobar"
s: java.lang.String = foobar
 
scala> s match {
| case r(f) => println(f)
| case _ => println("not found")
| }
foobar

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.