search_pattern: Define a search pattern for use with the find method on a...

Description Usage Arguments Details Note Examples

Description

A search pattern is one of the following:

Usage

1

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## 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".

## End(Not run)

syberia/director documentation built on May 30, 2019, 10:40 p.m.