[R] Regular expressions and 2 dots

Rui Barradas ru|pb@rr@d@@ @end|ng |rom @@po@pt
Fri Jun 28 10:18:45 CEST 2019


Hello,

Try

s <- c( "colone..xx.","coltwo.ft..rr.","colthree.gh..az.","colfour.DG..lm.")

sub("\\.{2,}.*$", "", s)
#[1] "colone"      "coltwo.ft"   "colthree.gh" "colfour.DG"

Às 09:00 de 28/06/19, lionel sicot via R-help escreveu:
> c( "colone..xx.","coltwo.ft..rr.","colthree.gh..az.","colfour.DG..lm.")



More information about the R-help mailing list