RosettaCodeData/Task/Regular-expressions/Scala/regular-expressions-2.scala
2023-07-01 13:44:08 -04:00

3 lines
215 B
Scala

"99 bottles of beer" matches "(\\d+) bottles of beer" // the full string must match
"99 bottles of beer" replace ("99", "98") // Single replacement
"99 bottles of beer" replaceAll ("b", "B") // Multiple replacement