summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorDaniel C. Sobral <dcsobral@gmail.com>2012-01-25 15:34:12 -0200
committerPaul Phillips <paulp@improving.org>2012-03-23 06:57:13 -0700
commit479dd13148c380619d3e9156ef1913467decc05c (patch)
tree22394bca3237003e5c05862ff551e49bdf8a8296 /test/files/run
parente3dec9f006ac2631281fb936c4ca206daa8fda5d (diff)
downloadscala-479dd13148c380619d3e9156ef1913467decc05c.tar.gz
scala-479dd13148c380619d3e9156ef1913467decc05c.tar.bz2
scala-479dd13148c380619d3e9156ef1913467decc05c.zip
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.
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/si4750.check1
-rw-r--r--test/files/run/si4750.scala7
2 files changed, 8 insertions, 0 deletions
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$"))
+}
+