This function maps one character vector to another, based on sequential
matching to a series of regular expressions. The return value corresponding
to each element in the source text is chosen based on the first matching
regex: once matched, later options are ignored.
A character vector of the same length as text, containing the
multiplexed strings. If none of the regexes matched, the corresponding
element will be NA.
Arguments
text
A vector of strings to match against.
...
One or more string arguments specifying a possible return value.
These are generally named with a regex, and the string is only used for a
given text element if the regex matches (and no previous one
matched). These strings may reference captured groups. Unnamed arguments
match unconditionally, and will always be taken literally.
options
A string composed of characters indicating variations on the
usual interpretation of the regex. These may currently include "i"
for case-insensitive matching, and "m" for multiline matching (in
which case "." matches the newline character).
encoding
A string specifying the encoding that matching will take
place in. The default is given by the "ore.encoding" option, which
is usually set automatically from the current locale when the package is
loaded, but can be modified if needed.