pattern_conc_search: pattern helper (specific)

View source: R/conc_search.R

pattern_conc_searchR Documentation

Description

get the pattern for correct (simple) searches, characterized by providing the initial sequence of the string wanted, where the code searched is concatenated. Note: this function mainly serves as an example for the author to remember how to do this! Be aware if your search strings are more complicated as the author is no expert in regular expression.

Usage

pattern_conc_search(s, code.sep = " ")

Arguments

s

string to match initial part of code

code.sep

the string that servers as separator in the concatenation

Examples

x <- c("ABC", "", "FFF XXX", "GGG  ABC FOO",
       "BAR  ABC", "FOO BAR ABB", " ", ";")
s.term = c("ABC", "X")
grepr(pattern = pattern_conc_search(s.term), x = x)
## sample example, different separator:
y <- gsub(pattern = " ", replacement = ";", x)
grepr(pattern = pattern_conc_search(s.term, code.sep = ";"), x = y)

renlund/datma documentation built on June 2, 2025, 5:12 a.m.