-
Notifications
You must be signed in to change notification settings - Fork 0
filter en
Hamatoma edited this page Aug 7, 2022
·
1 revision
Patterns are used to specify the parts of the input that should appear in the output.
| Surname | Type | Description | Example |
|---|---|---|---|
| append | bool | the result is appended in the destination buffer |
app
|
| end | pattern | Only lines that come before a line that matches this search pattern are examined. |
end="</address>"
|
| filter | pattern | If a line matches this regular expression, it is transferred to the target. |
filter=r/2021\.\d+.\d+/
|
| Filter | patternList | A list of regular expressions: If one fits on a line, it will be included in the target. auto separator. |
Filters=;/Hello /;r/[hH]i /"
|
| input | bufferName | The text from this buffer is filtered. Default: input |
input=data
|
| meta | character | Delimiter for the placeholders inside input. Default: % |
meta=%
|
| output | bufferName | the result is written to this buffer. Default: output |
output=result
|
| repeat | nat | If this number is greater than 1, the area start and end is searched for accordingly. 0: search as often as you like. Only useful if both start and end are defined. Default: 1 | repeat=5 |
| begin | pattern | Only lines that follow a line that matches this search pattern are examined. |
start=/<address>/start=r/<(id|name)/
|
| template | string | This template is output for each hit after the placeholders have been replaced there. If no template is specified, the entire line with the match is output. May contain interpolated text. |
template=i~"Name: %1%~n"
|
| Template | stringList | The analogue of template if Filters is specified instead of filter. The first entry in 'Templates' maps to the first entry in Filters, and so on. If no Templates is specified, the entire line with the match is output. May contain interpolated text. |
Templates=;i~"Name: %1%~n";i~"Id: %1%~n"
|
Hints:
- Exactly one of the parameters filter and Filters must be specified, not none and not both.
- At most one of the parameters template and Templates may be specified.
The following placeholders can appear in the parameters template and Templates:
- %group0%: the entire regular expression match.
- %group1%: what is matched with the first pair of parentheses in the regular expression. Pairs of parentheses are numbered after the occurrence of the opening parenthesis.
- %group2%: what is matched with the second pair of brackets in the regular expression.
- %0%: the short form for %group0%
- %1%: the short form for %group1%
Applies to all examples: Buffer input contains:
<?xml version="1.0" encoding="UTF-8"?>
<staff>
<company>
<name>Easy Rider</name>
</company>
<person>
<id>1</id>
<name>Adam</name>
</person>
<person>
<id>2</id>
<name>Berta</name>
</person>
<person>
<id>3</id>
<name>Charly</name>
</person>
</staff>
Command:
filter fi=/name/Buffer output says:
<name>Easy Rider</name>
<name>Adam</name>
<name>Berta</name>
<name>Charlie</name>
Command:
filter start=/<person/ end=!</person!>fi=/name/ repeat=2Buffer output says:
<name>Adam</name>
<name>Berta</name>
Command:
filter start=/<person/ end=!</person!>fi=r/<(name|id)>(.*?)</repeat=2>template="%group1%: %group2%Buffer output says:
id: 1 name: Adam ID: 2 name BerthaCommand:
filter start=/<person/ end=!</person!>Filters=;"<name";"<id" repeat=2In Buffer output:
<id>1</id>
<name>Adam</name>
<id>1</id>
<name>Berta</name>
Command:
filter start=/<person/ end=!</person!>Filters=;r"<(name)>(.?*)<";r"<id>(.?*)<" repeat=2 Templates=";%1%: %2%;no: %1% "In Buffer output:
no: 1 name: Adam no: 2 name: Berta