R: Matching functions

matchfuns {registry} | R Documentation

## Matching functions

### Description

Functions used for lookups of search keys.

### Usage

    match_ignorecase(lookup, entry, ...)
    match_exact(lookup, entry, ...)
    match_partial(lookup, entry, ...)
    match_partial_ignorecase(lookup, entry, ...)
    match_regexp(lookup, entry, ...)

### Arguments

`lookup` | Search value to look up (for some key field).
`entry` | Vector of key values where `lookup` is sought.
`...` | For `match_ignorecase` and `match_exact`: currently not used. For `match_partial` and `match_partial_ignorecase`: additional arguments passed to `pmatch`. For `match_regexp`: additional arguments passed to `grep`.

### Details

These are matching functions to be specified for key fields, controlling how search values are looked up in the registry.

### Author(s)

David Meyer David.Meyer@R-project.org

### See Also

`regobj`

### Examples

    ## use exact matching
    R <- registry(stop_if_missing = FALSE)
    R$set_field("Key", type = "character", is_key = TRUE, index_FUN = match_exact)
    R$set_field("Value", type = "numeric")
    R$set_entry("the key", 1)

    R[["the key"]]
    R[["the"]]

    ## use partial matching
    R <- registry()
    R$set_field("Key", type = "character", is_key = TRUE, index_FUN = match_partial)
    R$set_field("Value", type = "numeric")
    R$set_entry("the key", 1)

    R[["the"]]

    ## use regular expressions
    R <- registry()
    R$set_field("Key", type = "character", is_key = TRUE, index_FUN = match_regexp)
    R$set_field("Value", type = "numeric")
    R$set_entry("the key", 1)
    R$set_entry("key", 2)

    R[["k.*"]]
    R["k.*"]

[Package registry version 0.5 Index]