Helper functions to extract position information for text styling and pattern matching. These functions return position vectors that can be used with styling rules to format specific parts of text strings.
Arguments
- text
A character string to search in
- character
A character string to search for (literal match)
- include_boundary
A logical indicating whether to include the position of the boundary character
- missing
A character string indicating how to handle missing positions. Options are "error", "none", or "all".
- pattern
A regular expression pattern to search for
Value
- `str_before()`: A numeric vector of length 2 containing the start position (1) and the position of the first occurrence of the character - `str_after()`: A numeric vector of length 2 containing the position of the first occurrence of the character and the end of the string - `str_matches()`: A matrix with start and end positions of the first match