test <- c("bye | S-A-TX-1-1", "bye | b-c-TY-2-1", "bye | d-e-TZ-3-3")
test_extract<- str_extract(test, "T[A-Z-0-9]+")
test_extract
#This pattern "T[A-Z-0-9]+" helps in matching either characters with letters in upper case from A - Z, digits from 0 - 9 or hyphen
1条答案
按热度按时间3htmauhk1#