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:
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.
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.
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.