I have a character vector, for example:
char <- c("cancer_6_53_7575_tumor.csv", "control_7_4_7363_healthy.csv")
I want to extract the part of the line starting with "7" in the 4-digit patient identifier and ending with ".", But the following method does not work when there is 7 before this patient identifier.
values <- unlist(qdapRegex::rm_between(char, "7", ".", extract = TRUE))
How to indicate that it should start with 7 in a 4-digit number?
regex r
Jack arnestad
source share