Skip to content
Prev 256534 / 398506 Next

regular expression question

On Mon, Apr 11, 2011 at 10:49 PM, Erin Hodgess <erinm.hodgess at gmail.com> wrote:
Not sure that this is what you mean, but here's an example of removing
all non-A-through-Z characters:

x = c("A.1", "B...2", "C..3..D");
gsub("[^(A-Z)]", "", x)
[1] "A"  "B"  "CD"

Basically you should look at the character substitution functions sub and gsub.

Peter