Hi, David
i would go with regex and ruby, i.e. =
with a given file test.html like that :
<html><body>
<p>foobar</p>
<li>
<p class="ListNumber" style>Delete me.</p>
</li>
<p>foobaz</p>
</body></html>
and an antscript like that :
<project name="bla" default="main" basedir=".">
<target name="main">
<script language="ruby">
<![CDATA[
infile = 'Y:/test.html'
outfile = 'Y:/testnew.html'
old = File.read(infile)
old.gsub!(/<li.*<\/li>/m, "")
File.open(outfile, "w") {|new| new.write(old)}
File.open(outfile, "w") {|new| new.write(old)}
if infile == outfile
puts 'Modified = '<<infile<<' inplace'
else
puts 'Modified = '<<infile<<' to = '<<outfile
end
]]>
</script>
</target>
</project>
you get a testnew.html like that :
<html><body>
<p>foobar</p>
<p>foobaz</p>
</body></html>
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)
http://jakarta.apache.org/bsf/
jruby.jar
http://jruby.codehaus.org/
Regards, Gilbert
-----Original Message-----
From: David Jacobsen [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 27, 2007 11:05 PM
To: [email protected]
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.
<li>
<p class="ListNumber" style>Delete me.</p>
</li>
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]