toy_corpus <- "Once upon a time there was a tiny toy corpus.
It consisted of three sentences. And it lived happily ever after."
(tks <- tokenize(toy_corpus))
# In `keep_re()`, the use of `re()` is optional
keep_re(tks, re("^.{3,}"))
keep_re(tks, "^.{3,}")
# When using brackets notation, `re()` is necessary
tks[re("^.{3,}")]
tks["^.{3,}"]
# build and print a `re` object
re("^.{3,}")
as_re("^.{3,}")
as.re("^.{3,}")
print(re("^.{3,}"))
Run the code above in your browser using DataLab