afs_regex_replace - AFS - Reference Guides

AFS Filters Description

Product
AFS
Platform
7.12
Category
Reference Guides
Language
English

The replace pattern filter can apply several pattern-matching replacement rules on a text content. If no transformation can be made, the initial content is copied to the output layer.

The filter is declared with the afs_regex_replace type. It is in the antidot-paf-misc package. It is a processor filter.

The Regex Replace filter specifications are described in the following table:

Parameter name

Mandatory

Type

Default

Description

rules

Yes

map

N/A

List of key, value pairs where key is the regex for matches, and value the replacement

case_insensitive

No

boolean

false

Set to true to enable case insensitive matching

comments

No

boolean

false

Allows blank spaces and comments within patterns.

dotall

No

boolean

false

When set, dots represent line terminators. Otherwise dots represents line end stops.

multiline

No

boolean

false

Controls the behavior of $ (dollar sign) and ^ (carets). When set, it recognizes line terminators in strings. Otherwise, it matches only the beginning and the end of input strings.

force_output_encoding

No

string

N/A

When set, this parameter overrides the dynamically detected encoding for the output. The value must be a valid charset (example: UTF-8, ASCII, ISO-LATIN-1, ISO-8859-1, CP1252 and so on)

input_layer

No

layer

CONTENTS

Input Layer

output_layer

No

layer

CONTENTS

Layer filled for each output document

The regular expression engine relies on the ICU library. The syntax and limitations of the engine must be followed as documented in regexp (http://userguide.icu-project.org/strings/regexp). Is it advised to check regex with ICU's Regular Expression Demonstration (http://demo.icu-project.org/icu-bin/redemo) before using it with AFS.