Question: Suppose I have a list of string:

```
distance <- c("CHI #12 DEBRINCAT(1), Snap, Off. Zone, 18 ft.Assists: #88 KANE(2); #56 GUSTAFSSON(1)", "TOR ONGOAL - #44 RIELLY, Backhand, Off. Zone, 77 ft.")

```

Now I hope to get a string vector that contains only the parts
that contains the distance, that is, substring = c ("18 ft", "77 ft").

Is there a convenient way in R to do this?

Answer: 
Using `str_extract` to match one or more digits followed by zero or more spaces (`\\s*`) and the substring 'ft'

```
library(stringr)
str_extract(distance, "\\d+\\s*ft")
#[1] "18 ft" "77 ft"

```
Try `gsub`

```
> gsub(".*?(\\d+\\s+ft).*", "\\1", distance)
[1] "18 ft" "77 ft"

```