Regular Expressions (abbreviated as REGEX, also known as “Grep”)" are a mini-language pattern-matching used by many computer languages (R, python), and programmes (OpenOffice/LibreOffice, RStudio “find” function).
We’ll use regular expressions through the tidyverse/stringr functions str_subset
(returns the matching strings) and str_detect
(returns TRUE
/FALSE
)
str_which
Returns the indexes of matching elementsstr_count
Returns how many times the pattern matchesstr_locate
,str_locate_all
Returns start and end position of matchesstr_extract
Returns the matching part of the string