ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <>
Subject RE: replace and replaceregexp - Multi line tokens or substitution expressions ?
Date Wed, 28 Mar 2007 06:15:12 GMT

Hi, David

i would go with regex and ruby, i.e. =

with a given file test.html like that :

 <p class="ListNumber" style>Delete me.</p>


and an antscript like that :

<project name="bla" default="main" basedir=".">

<target name="main">
        <script language="ruby">
        infile = 'Y:/test.html'
        outfile = 'Y:/testnew.html'
        old =
        old.gsub!(/<li.*<\/li>/m, ""), "w") {|new| new.write(old)}, "w") {|new| new.write(old)}
            if infile == outfile
              puts 'Modified = '<<infile<<' inplace'
              puts 'Modified = '<<infile<<' to = '<<outfile


you get a testnew.html like that :



Options in the ruby part =

you could use the same file for infile and outfile, your
html file gets modified inplace then.

you need =

bsf.jar (Bean Scripting Framwork)

Regards, Gilbert

-----Original Message-----
From: David Jacobsen [] 
Sent: Tuesday, March 27, 2007 11:05 PM
Subject: replace and replaceregexp - Multi line tokens or substitution expressions ?

Does anyone know if there is way for a token to include multiple lines?  I want to strip four
lines from HTML files.

 <p class="ListNumber" style>Delete me.</p>


IĆ¢EUR(tm)m on Windows.

C:\RoboHelpTemp>java -version
java version "1.5.0_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode)

C:\RoboHelpTemp>ant -v
Apache Ant version 1.7.0 compiled on December 13 2006

Don't get soaked.  Take a quick peek at the forecast 
 with theYahoo! Search weather shortcut.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message