RosettaCodeData/Task/Regular-expressions/Scala/regular-expressions-1.scala
Ingy döt Net b83f433714 tasks a-s
2013-04-10 23:57:08 -07:00

4 lines
439 B
Scala

val Bottles1 = "(\\d+) bottles of beer".r // syntactic sugar
val Bottles2 = """(\d+) bottles of beer""".r // using triple-quotes to preserve backslashes
val Bottles3 = new scala.util.matching.Regex("(\\d+) bottles of beer") // standard
val Bottles4 = new scala.util.matching.Regex("""(\d+) bottles of beer""", "bottles") // with named groups