I want to logically, find IDs in a file. These will have only digits, letters, and dashes. They must containa digit to be considered. I could do a Boolean with 2 grepl
statements but want to do this with a single regex. I think (SKIP)(FAIL) could work but don't know how. In the following I want elements 1, 2, 5, 6 to be considered IDs.
g <- c(
"868776767-ddd-dFFF-999999",
"8888888",
"bbbbbbfdfdgtfref-dsfcsdbcgwecbgfecshdcs-cdhscgbfsd",
"bigbird",
"2",
"3-4",
"swe%h"
)
## This works (I want this result with one regex)
grepl("[A-Za-z0-9-]+", g) & grepl("[0-9]+", g)
## I suspect using this could work with a single regex call.
grepl("(*SKIP)(*FAIL)", g)