regex multiple pattern with singular replacement

> A<-"this string,  contains a handful of,  useless:  punctuation.  Some are to escape.  Aaargh! Some might be needed,  but I want none!"
> gsub(", |: |\\. |!","",A)
[1] "this string contains a handful of useless punctuation Some are to escape Aaargh Some might be needed but I want none"

You can use | to mean "or"

> str_replace_all(county, "st\\.|ste\\.", "st")
[1] "st landry"   "st geneveve" "st louis"   

Or in base R

> gsub("st\\.|ste\\.", "st", county)
[1] "st landry"   "st geneveve" "st louis"  

Tags:

Regex

R

Stringr