Question

Wnen I added

<linecontainsregexp negate="true">
                 <regexp pattern="src=&quot;http://*"/>
            </linecontainsregexp>

inside <replaceregexp> task, I am getting error replaceregexp doesn't support the nested "linecontainsregexp" element.

Was it helpful?

Solution

<linecontainsregexp> is only valid inside <filterchain>. In turn, <filterchain>s is not supported by task <replaceregexp>. are only supported by tasks

<replaceregexp> is usually applied after copying files. <filterchain>s are applied while copies are performed.

Basically, you have 2 alternatives:

  1. Modify your <replaceregexp> task with a more sophisticated regular expression that only matches what you want, probably resorting to lookarounds.
  2. Add a <filterchain> to the <copy> or <move> task that you are using to copy these files from your source management system. Include filter <tokenfilter>, most probably with a child <filetokenizer/>, and children <containsregex> and <replaceregex> as needed. This is much more flexible. There are a couple dozen filters and tokenizers to choose from.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top