> On Jul 26, 2016, at 2:28 PM, Dimitri Liakhovitski > <dimitri.liakhovit...@gmail.com> wrote: > > gsub("[^0-9]", "", x)
?regex I think you might be bit embarrassed because it seems pretty obvious once you know that character class elements like "." don't need to be escaped so it's just this: > gsub("[^0-9.]", "", x) [1] "84" "293.04" "12.5" You might want to add in some separator if you are processing expression this way. > gsub("[^0-9., ]", "", gsub( "[-+*/]", " , ", x) ) [1] " , 84" " , 293.04 , 1200" " 12.5" -- David Winsemius Alameda, CA, USA ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.