>>>>> Petr Savicky <savi...@cs.cas.cz> >>>>> on Wed, 15 Dec 2010 14:21:37 +0100 writes:
> On Wed, Dec 15, 2010 at 11:08:06AM -0200, Henrique > Dallazuanna wrote: >> Try this: >> >> gsub("[^0-9]", "", "AB15E9SDF654VKBN?dvb.65") > Consider also > strsplit("AB15E9SDF654VKBN?dvb.65", "[^.0-9][^.0-9]*") > [[1]] [1] "" "15" "9" "654" ".65" which can be abbreviated to strsplit("AB15E9SDF654VKBN?dvb.65", "[^.0-9]+") Note: R's regular expression matching capability is really very close to Perl's and in those cases it is not, these functions have an argument 'perl' (default FALSE) you can switch on. Martin >> On Wed, Dec 15, 2010 at 6:55 AM, Luis Felipe Parra < >> felipe.pa...@quantil.com.co> wrote: >> >> > Hello, I have stings which have all sort of characters >> (numbers, letters, > punctuation marks, etc) I would like >> to stay only with the numbers in them, > does somebody >> know how to do this? >> > >> > Thank you >> > >> > Felipe Parra > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do > read the posting guide > http://www.R-project.org/posting-guide.html and provide > commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.