Re: [R] Regular expressions and 2 dots

2019-06-28 Thread Rui Barradas
Hello, Please always cc the list. To know more about the regular expressions used by r read help("regex") The one I used is not very complicated. \\. match a dot; it is a meta-character so it needs to be escaped. {2,} repeated at least 2 times, at most an undetermined number of times. .* a

Re: [R] Regular expressions and 2 dots

2019-06-28 Thread Rui Barradas
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

[R] Regular expressions and 2 dots

2019-06-28 Thread lionel sicot via R-help
Hello, I have files from an equipment with column names including dots.I would like to simplify these names but all my attempts with sub and regular expressions are unsuccessful. I havec( "colone..xx.","coltwo.ft..rr.","colthree.gh..az.","colfour.DG..lm.")and I would like to have c( "colone","c