Matching

We wish to check whether a pattern match occurs in a target string. This operation is often referred to as Pattern Matching.

This section is organized to cover the four common scenarios of string pattern matching which are:

  1. Detecting: String pattern matching operations that return a logical; TRUE if the there is a match of the pattern inside the target string and FALSE otherwise.
  2. Locating: String pattern matching operations that return the location of the pattern in the target string as an integer if the pattern exists. The return is NA if a pattern match doesn't occur.
  3. Counting: String pattern matching operations that return the number of occurrences of the pattern in the target string. The return is zero if a pattern match doesn't occur.
  4. Filtering where we cover how to filter an input list of strings based on how they match a given pattern.
PYTHON
I/O