regex in r
# Example string
text <- "The quick brown fox jumps over the lazy dog."
# Step 1: Load the 'stringr' library
library(stringr)
# Step 2: Define a regular expression pattern
pattern <- "[aeiou]"
# Step 3: Use the 'str_extract_all' function to find all matches
matches <- str_extract_all(text, pattern)
# Step 4: Flatten the list of matches into a single vector
matches <- unlist(matches)
# Step 5: Print the result
print(matches)