diff options
author | Ito Kazumitsu <kaz@maczuka.gcd.org> | 2006-02-09 13:44:58 +0000 |
---|---|---|
committer | Ito Kazumitsu <kaz@maczuka.gcd.org> | 2006-02-09 13:44:58 +0000 |
commit | 8d10b46b09bb655c0c1e332b1afa3ed26bb50237 (patch) | |
tree | 82706fb44d1efb45074acef2d0bddd09bb7801ed /java/util/regex | |
parent | 9460f315752210eeb2a38061e30cf2b9a9009ddf (diff) | |
download | classpath-8d10b46b09bb655c0c1e332b1afa3ed26bb50237.tar.gz |
2006-02-09 Ito Kazumitsu <kaz@maczuka.gcd.org>
Fixes bug #26112
* gnu/regexp/RE.java(REG_REPLACE_USE_BACKSLASHESCAPE): New execution
flag which enables backslash escape in a replacement.
(getReplacement): New public static method.
(substituteImpl),(substituteAllImpl): Use getReplacement.
* gnu/regexp/REMatch.java(substituteInto): Replace $n even if n>=10.
* java/util/regex/Matcher.java(appendReplacement)
Use RE#getReplacement.
(replaceFirst),(replaceAll): Use RE.REG_REPLACE_USE_BACKSLASHESCAPE.
Diffstat (limited to 'java/util/regex')
-rw-r--r-- | java/util/regex/Matcher.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/java/util/regex/Matcher.java b/java/util/regex/Matcher.java index 3885eb26c..98086bfdb 100644 --- a/java/util/regex/Matcher.java +++ b/java/util/regex/Matcher.java @@ -75,7 +75,8 @@ public final class Matcher implements MatchResult assertMatchOp(); sb.append(input.subSequence(appendPosition, match.getStartIndex()).toString()); - sb.append(match.substituteInto(replacement)); + sb.append(RE.getReplacement(replacement, match, + RE.REG_REPLACE_USE_BACKSLASHESCAPE)); appendPosition = match.getEndIndex(); return this; } @@ -190,7 +191,8 @@ public final class Matcher implements MatchResult { reset(); // Semantics might not quite match - return pattern.getRE().substitute(input, replacement, position); + return pattern.getRE().substitute(input, replacement, position, + RE.REG_REPLACE_USE_BACKSLASHESCAPE); } /** @@ -199,7 +201,8 @@ public final class Matcher implements MatchResult public String replaceAll (String replacement) { reset(); - return pattern.getRE().substituteAll(input, replacement, position); + return pattern.getRE().substituteAll(input, replacement, position, + RE.REG_REPLACE_USE_BACKSLASHESCAPE); } public int groupCount () |