I have a character vector with 8 string elements. I am trying to understand how to use regex to identify objects based on certain criteria.
"Horse" "21-35" "house" "orange" "I271" "78.96" "B42" "yes/no"
I would like to identify objects that start with a certain value, let's say any number.
grep("^[0-9]+", string, value = TRUE)
should work based on the readings I've done for regex but it seems to be giving me only objects that start with letters. Alternatively,
grep("[a-zA-Z]+", string, value = TRUE)
seems like it should work but this gives me all of the elements containing 1 letter. I would like to do more than something as mundane as this but I need to learn how to use the applications before moving on.