You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2005/08/18 12:16:53 UTC

DO NOT REPLY [Bug 36239] New: - in does not honour flags="s"

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=36239>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=36239

           Summary: <replaceregex> in <tokenfilter> does not honour
                    flags="s"
           Product: Ant
           Version: 1.6.5
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: matt@cenqua.com


When using <repalceregex>, specifying flags="s" has no effect (that is, you want the regex to span 
lines).

Example:
<project basedir="." default="test" name="test">
  <target name="test">
    <copy overwrite="true" file="src.txt" tofile="dest.txt">
      <filterchain>
	<tokenfilter>
	  <replaceregex pattern="START.*" replace="SNIP" flags="gs"/>
	</tokenfilter>
      </filterchain>
    </copy>
  </target>
</project>

== src.txt ==
line1
foo START this bit should disappear
and so should this bit
== ==

To Reproduce:
Run the above build.xml, and look at dest.txt. Everything from START to EOF should be replaced with 
"snip", but it is not. Changing or removing the byline attribute has no effect.

Diagnosis:
I had a look at TokenFilter.ChainableReaderFilter. The "byline" attribute seems to be what I want, but 
running this through a debugger proved that ChainableReaderFilter.chain(Reader) is *never* called.

Solution:
Not to sure, reading the whole TokenFilter/ChainableReader thing was like chasing a rabbit down a hole 
:P

Workaround:
I wrote my own FilteredReader to use with <filterreader>

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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