grepl() / gsub()
Searching and replacing.
Syntax
grepl("x", s) // gsub("a", "b", s)Description
grepl tells whether a substring is in the text (TRUE/FALSE). gsub replaces all matches with a new one.
Example
Loading editor…
Expected output
TRUE 2024/01
When to use?
Search boxes, text sanitization.