antology 2.0.7
Chainable reader

<replaceAll>

A filter reader that replaces all matches of a regular expression with a replacement string.

The pattern search is stream-oriented, not line-oriented, i.e. matches are found even across line boundaries. Thus the pattern typically enables (?m) (multi-line mode) and/or (?s) (dotall mode).

This filter reader is semantically almost equivalent with

  <tokenfilter>
    <filetokenizer />
    <replaceregex
      pattern="regex"
      flags="s"
      replace="replacement-string"
    />
  </tokenfilter>

, but is much more efficient in many cases, because the <filetokenizer /> always reads the entire content into memory, while <replaceAll /> processes the content in a "sliding" manner which requires only very little memory if the regex matches relative short sequences.

antology 2.0.7

Copyright © 2019. All rights reserved.