Download BibTool Manual
Transcript
A.8. Selecting Items
33
An example of extracting can be seen in section 1.2.4 on page 10.
A.8.2. Extracting with Sub-string Matching
The simplest way of specifying an entry—except by giving its key—is to give a string
which has to be present in one of the fields or pseudo-fields. The resource select.by.string
can be used to store a selection rule which is applied at the appropriate time later
on. If several rules are supplied then any entry matching one of the rules is selected.
Thus different rules act as alternatives. This includes rules with regular expressions as
described in section A.8.3.
The simplest form of the resource select.by.string is to specify a single string to search
for. This string has to be enclosed in double quotes. Since the argument of the resource
has to be enclosed in braces we get the following funny syntax:
select.by.string {”some string”}
This operation selects all entries containing some string in one of the normal fields.
The search can be restricted to specific fields or extended to pseudo-fields by specifying
those fields before the search string. An arbitrary number of white-space separated fields
can be given there. Thus the general syntax for this resource is as follows:
select.by.string {field1 . . . fieldn ”string”}
To make this selection operation more flexible it is possible to determine whether or not
the comparison against the value of a field is performed case sensitive. This can be done
with the Boolean resource select.case.sensitive. Since the selection is performed after all
resources have been read the value of this resource is only considered then. Thus it
is not possible to mix case sensitive and non case sensitive selections as with regular
expressions (see section A.8.3).
During the matching of the search string against the value of a field BibTool ignores
certain characters. Thus it is possible to hide irrelevant details like braces or spaces.
The characters to ignore are stored in the resource select.by.string.ignored. As a default
the following resource command is performed implicitly:
select.by.string.ignored {”{} []”}
As for the resource select.case.sensitive the evaluation of the resource select.by.string.ignored
is performed just before the comparisons are carried out. Thus it is not possible to use
several rules with different ignored sets of characters.
In addition to the functionality described above the resource select.by.non.string can be
used to select all entries for which the match against the given field fails. The general
form is the same as for select.by.string: