Regex within dplyr/select helpers

The only select helper that allows regexes (from my brief read of the docs) is matches. Fortunately, the $ sign "anchors" the end of the string in a regex, so you should be able use that with matches.

suppressPackageStartupMessages(library(tidyverse))
df1 <- tribble(
  ~id, ~notselected, ~selected1, ~selected2,
  1, "a", "b", "c"
)

df1 %>% select(id, matches("\\d$"))
#> # A tibble: 1 x 3
#>      id selected1 selected2
#>   <dbl>     <chr>     <chr>
#> 1     1         b         c
8 Likes