# check if string contains substring grepl("substring", "string") # match multiple alternatives using regexp input_string <- c("option 1", "option one") grep("option \\d+|option \\w+", input_string, value = TRUE, perl = TRUE)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter