Intermediate Regular Expressions in R
Angelo Zehr
Data Journalist
str_matchstr_replacestr_match_allstr_replace_allextract(
data,
col,
into,
regex = "([[:alnum:]]+)",
remove = TRUE,
convert = FALSE,
...
)
extract(
data,
col,
into,
regex = "([[:alnum:]]+)",
remove = TRUE,
convert = FALSE,
...
)
data
col
into
regex
remove
convert


screens_per_movie %<>%
mutate(
is_3d = str_match(line, "3D")
)

screens_per_movie %<>%
mutate(
is_3d = str_match(line, "3D")
)



extract(
screens_per_movie,
col = "line",
into = c("is_3d", "screens"),
regex = "(3D).*?(\\d+)$",
remove = FALSE
)

extract(
screens_per_movie,
col = "line",
into = c("is_3d", "screens"),
regex = "(3D).*?(\\d+)$",
remove = FALSE
)
Intermediate Regular Expressions in R