I have the vector:

    stri = c("Stage II", "Stage IVA", "Stage IIIB", "ACB" )

and I want to remove the A and B in "Stage IVA"   ,"Stage IIIB", but not in "ACB",

I want to get

    c("Stage II", "Stage IV", "Stage III", "ACB" )

Is there any method by using gsub? 


Fortunately, I find the way to solve it. 

Here is the answer: 

    gsub("(^Stage.*)(A|B)","\\\\1", stri, perl = TRUE)

