Permalink
Fetching contributors…
Cannot retrieve contributors at this time
35 lines (27 sloc) 1.06 KB
---
title: "stringr 1.1.0"
date: "2016-08-24"
---
```{r, echo = FALSE}
knitr::opts_chunk$set(comment = "#>", collapse = T)
library(stringr)
```
This release is mostly bug fixes, but there are a couple of new features you might care out.
* There are three new datasets, `fruit`, `words` and `sentences`, to
help you practice your regular expression skills:
```{r}
str_subset(fruit, "(..)\\1")
head(words)
sentences[1]
```
* More functions work with `boundary()`: `str_detect()` and `str_subset()`
can detect boundaries, and `str_extract()` and `str_extract_all()` pull out
the components between boundaries. This is particularly useful if
you want to extract logical constructs like words or sentences.
```{r}
x <- "This is harder than you might expect, e.g. punctuation!"
x %>% str_extract_all(boundary("word")) %>% .[[1]]
x %>% str_extract(boundary("sentence"))
```
* `str_view()` and `str_view_all()` create HTML widgets that display regular
expression matches. This is particularly useful for teaching.