gsub function to remove any alphanumeric word with lowercase characters

Just trying to find the right notation for gsub to take any word (can be combination with numbers) with a lowercase letter and remove it.

My current attempt is:

d1 <- c("Hello, HO3W are You dOING?")
d1 <- gsub("[a-z]+\s+", " ", d1)

I'd like to only get HO3W to return.

Solved myself

d1 <- gsub("[[:alpha:]][a-z]+|[a-z][[:alpha:]]+", "", d1)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.