git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274633 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -181,6 +181,15 @@ | |||||
| </concat> | </concat> | ||||
| </target> | </target> | ||||
| <target name="dollermatch"> | |||||
| <concat> | |||||
| @hello@ | |||||
| <filterchain> | |||||
| <replaceregex pattern="@([^@]*)@" replace="${\1}"/> | |||||
| </filterchain> | |||||
| </concat> | |||||
| </target> | |||||
| <!-- need to check for existance of regex --> | <!-- need to check for existance of regex --> | ||||
| <target name="containsregex"> | <target name="containsregex"> | ||||
| <concat destfile="result/input"> | <concat destfile="result/input"> | ||||
| @@ -76,7 +76,10 @@ public class JakartaOroRegexp extends JakartaOroMatcher implements Regexp { | |||||
| StringBuffer subst = new StringBuffer(); | StringBuffer subst = new StringBuffer(); | ||||
| for (int i = 0; i < argument.length(); i++) { | for (int i = 0; i < argument.length(); i++) { | ||||
| char c = argument.charAt(i); | char c = argument.charAt(i); | ||||
| if (c == '\\') { | |||||
| if (c == '$') { | |||||
| subst.append('\\'); | |||||
| subst.append('$'); | |||||
| } else if (c == '\\') { | |||||
| if (++i < argument.length()) { | if (++i < argument.length()) { | ||||
| c = argument.charAt(i); | c = argument.charAt(i); | ||||
| int value = Character.digit(c, 10); | int value = Character.digit(c, 10); | ||||
| @@ -83,7 +83,10 @@ public class Jdk14RegexpRegexp extends Jdk14RegexpMatcher implements Regexp { | |||||
| StringBuffer subst = new StringBuffer(); | StringBuffer subst = new StringBuffer(); | ||||
| for (int i = 0; i < argument.length(); i++) { | for (int i = 0; i < argument.length(); i++) { | ||||
| char c = argument.charAt(i); | char c = argument.charAt(i); | ||||
| if (c == '\\') { | |||||
| if (c == '$') { | |||||
| subst.append('\\'); | |||||
| subst.append('$'); | |||||
| } else if (c == '\\') { | |||||
| if (++i < argument.length()) { | if (++i < argument.length()) { | ||||
| c = argument.charAt(i); | c = argument.charAt(i); | ||||
| int value = Character.digit(c, 10); | int value = Character.digit(c, 10); | ||||
| @@ -77,7 +77,7 @@ public class TokenFilterTest extends BuildFileTest { | |||||
| } | } | ||||
| public void tearDown() { | public void tearDown() { | ||||
| //executeTarget("cleanup"); | |||||
| executeTarget("cleanup"); | |||||
| } | } | ||||
| /** make sure tokenfilter exists */ | /** make sure tokenfilter exists */ | ||||
| @@ -147,6 +147,12 @@ public class TokenFilterTest extends BuildFileTest { | |||||
| assertStringContains(contents, "world world world world"); | assertStringContains(contents, "world world world world"); | ||||
| } | } | ||||
| public void testHandleDollerMatch() throws IOException { | |||||
| if (! hasRegex("testFilterReplaceRegex")) | |||||
| return; | |||||
| executeTarget("dollermatch"); | |||||
| } | |||||
| public void testTrimFile() throws IOException { | public void testTrimFile() throws IOException { | ||||
| String contents = getFileString( | String contents = getFileString( | ||||
| "trimfile", "result/trimfile"); | "trimfile", "result/trimfile"); | ||||