From 479dd13148c380619d3e9156ef1913467decc05c Mon Sep 17 00:00:00 2001 From: "Daniel C. Sobral" Date: Wed, 25 Jan 2012 15:34:12 -0200 Subject: Document regex replacement strings behavior. All replacement methods use dolar signs to identify groups in the matched string, and backslashes to escape characters. Document this behavior, and provide a method that can be used to properly quote replacement strings when this behavior is not desired. Closes SI-4750. --- test/files/run/si4750.check | 1 + test/files/run/si4750.scala | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 test/files/run/si4750.check create mode 100644 test/files/run/si4750.scala (limited to 'test/files/run') diff --git a/test/files/run/si4750.check b/test/files/run/si4750.check new file mode 100644 index 0000000000..bf55f70df3 --- /dev/null +++ b/test/files/run/si4750.check @@ -0,0 +1 @@ +US$ 5.80 diff --git a/test/files/run/si4750.scala b/test/files/run/si4750.scala new file mode 100644 index 0000000000..96d2c4fec7 --- /dev/null +++ b/test/files/run/si4750.scala @@ -0,0 +1,7 @@ +import scala.util.matching.Regex + +object Test extends App { + val input = "CURRENCY 5.80" + println("CURRENCY".r.replaceAllIn(input, Regex quoteReplacement "US$")) +} + -- cgit v1.2.3