On 5/17/13 1:15 PM, Bergquist, Brett wrote:
Thanks, Brett. It turns out my problem wasn't with the regular expression but with the replacement text. My angle brackets were confusing the xml reader and I needed to escape them with xml entities. The following code does the right thing:It depends :)If the property "ant.regexp.regexpimpl" is not defined, it will default use the "org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp" implementation which is a wrapper for java.util.regex package. http://docs.oracle.com/javase/6/docs/api/java/util/regex/package-summary.html and the pattern can be: http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html -----Original Message----- From: Rick Hillegas [mailto:[email protected]] Sent: Friday, May 17, 2013 4:00 PM To: [email protected] Subject: need some advice about regular expression syntax in ant I am trying to convert the grammer to use generics. Unfortunately, our javacc turns out 1.4 java. That's mostly ok except for the places where the grammar spits out its own internal machinery. Probably upgrading our version of javacc is a good long-term solution but I don't want to pull on that ball of yarn right now if I don't have to. So I thought I could add another regular expression filter to the grammar building target. Specifically, I want to perform the following transformations on the generated SQLParser file: java.util.Vector -> java.util.Vector<Object> java.util.Enumeration -> java.util.Enumeration<Object> I'm having difficulty tracking down the regular expression syntax used by the ant replaceregexp task. Would appreciate any pointers. Thanks, -Rick
<replaceregexp match="java.util.Enumeration" replace="java.util.Enumeration<Object>" flags="m">
<fileset dir="${generated.src.dir}/${derby.dir}/impl/sql/compile">
<include name="SQLParser.java"/>
</fileset>
</replaceregexp>
Thanks,
-Rick
