A search pattern is one of the following:

search_pattern(pattern, method)

Arguments

pattern

character. The pattern to search for.

method

character. The search pattern method, one of "exact", "partial", "wildcard", or "regex".

Details

exact

match. The strings must match exactly this value.

partial

match. The strings which contain this string as a substring will be matched.

wildcard

match. Fuzzy matching like in the ctrl+p plugin for vim. If the pattern is "abc", it will be translated to the regular expression ".*a.*b.*c.*", that is, any characters followed by an 'a' followed by any characters followed by a 'b' followed by any characters followed by a 'c' followed by any characters (e.g., "fabulous cake"). Note that wildcard match is case insensitive.

regex

match. Apply a regular expression filter to the set of strings.

Note

Patterns can be combined using the | and & operators.

Examples

not_run({ d$find(search_pattern("this/file", "exact")) # If d is a director object, the above will find exactly the resource # "this/file". d$find(search_pattern("this", "partial")) # The above will find any resource containing "this" as a substring. d$find(search_pattern("this", "wildcard")) # The above will find any resource containing the consecutive letters # "this" separated by arbitrary strings. d$find(search_pattern("foobar", "partial") | search_pattern("root", "exact")) # The above will find any resource with the substring "foobar" or having # exactly the name "root". })