docs: more csv conditional block doc
This commit is contained in:
parent
d53d410866
commit
365b9b6cb9
24
MANUAL.md
24
MANUAL.md
@ -496,25 +496,29 @@ The following kinds of rule can appear in any order:
|
|||||||
**if** *PATTERNS*<br> *FIELDASSIGNMENTS*
|
**if** *PATTERNS*<br> *FIELDASSIGNMENTS*
|
||||||
: (Conditional block) This applies the field assignments only to CSV records matched by one of the PATTERNS.
|
: (Conditional block) This applies the field assignments only to CSV records matched by one of the PATTERNS.
|
||||||
|
|
||||||
PATTERNS is one or more regular expressions, each on its own line starting in column 0.
|
PATTERNS is one or more regular expressions, each on its own line.
|
||||||
(As a special case, the first pattern may be written on the same line as `if`.)
|
The first pattern can optionally be written on the same line as
|
||||||
<!-- then an optional `~` (indicating case-insensitive infix regular expression matching),\ -->
|
the `if`; patterns on the following lines must start in column 0
|
||||||
|
(no indenting). The regular expressions are case insensitive, and
|
||||||
|
can match anywhere within the whole CSV record. (It's not yet
|
||||||
|
possible to match within a specific field.)
|
||||||
|
|
||||||
FIELDASSIGNMENTS is one ore more indented field assignments, one per line.
|
FIELDASSIGNMENTS is one or more field assignments (described
|
||||||
|
above), each on its own line and indented by at least one
|
||||||
|
space. (The indent is required for successful parsing.)
|
||||||
|
|
||||||
Example 1. The simplest conditional block has a single pattern and
|
Example 1. The simplest conditional block has a single pattern and
|
||||||
a single field assignment. Here, any CSV record containing the
|
a single field assignment. Here, any CSV record containing the
|
||||||
pattern "groceries" (anywhere within the whole record; case
|
pattern `groceries` will have its account2 field set to
|
||||||
insensitive) will have its account2 field set to
|
`expenses:groceries`.
|
||||||
"expenses:groceries".
|
|
||||||
|
|
||||||
if groceries
|
if groceries
|
||||||
account2 expenses:groceries
|
account2 expenses:groceries
|
||||||
|
|
||||||
Example 2. Here, CSV records containing any of these patterns will
|
Example 2. Here, CSV records containing any of these patterns will
|
||||||
have their account2 and comment fields set as shown. Note the
|
have their account2 and comment fields set as shown. The
|
||||||
patterns are not indented, while the assignments are indented by
|
capitalisation is not required, that's just how I copied them from
|
||||||
at least one space - this is required for successful parsing.
|
my bank's CSV.
|
||||||
|
|
||||||
if ~
|
if ~
|
||||||
MONTHLY SERVICE FEE
|
MONTHLY SERVICE FEE
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user