ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jakob" <ja...@jfix.com>
Subject regexp contains "<" and ">" ...
Date Tue, 23 Mar 2004 16:02:24 GMT
Hi,

I am using Ant 1.6.0, and I would like to use Ant's
regular expression task <replaceregexp/> to modify an XML
file.  I know that this is not the ideal way to do this,
but this is a mixed-content issue for which XSLT is not
really appropriate.  Apparently, the problem is that the
reserved character "<" is used inside an attribute value
...


I would like to change this regexp

([^\s]+)<SUB>([^<]+)</SUB>

with this:

<dy:sym>\1<SUB>\2</SUB></dy:sym>


I have tried these:

<replaceregexp flags="g" byline="false">
  <regexp pattern="([^\s]+)<SUB>([^<]+)</SUB>"/>
  <substitution
expression="<dy:sym>\1<SUB>\2</SUB></dy:sym>"/>
  <fileset dir="test"><includes="test.xml"/></fileset>
</replaceregexp>

E:\test\build.xml:167: The value of attribute "pattern"
associated with an element type "regexp" must not contain
the '<' character.

<replaceregexp flags="g" byline="false">
  <regexp><![CDATA[([^\s]+)<SUB>([^<]+)</SUB>]]></regexp>
  <substitution><![CDATA[<dy:sym>\1<SUB>\2</SUB></dy:sym>]]></substitution>
  <fileset dir="test"><include name="test.xml"/></fileset>
</replaceregexp>

E:\test\build.xml:173: The <regexp> type doesn't support
nested text data.


Is there a way to do this in Ant, or should/must I call an
external task?

Thanks in advance,
Jakob.




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message