[R] Numbers in a string

Dieter Menne dieter.menne at menne-biomed.de
Thu Dec 16 15:17:45 CET 2010



Petr Savicky wrote:
> 
> One of the suggestions in this thread was to use an external program.
> A possible solution without negation in Perl is
> 
>   @a = ("AB15E9SDF654VKBN?dvb.65" =~ m/[0-9]/g);
>   print @a, "\n";
>   15965465
> 
> 

Which is

 gsub("[^0-9]", "", "AB15E9SDF654VKBN?dvb.65")

as Henrique suggested.

Dieter

-- 
View this message in context: http://r.789695.n4.nabble.com/Numbers-in-a-string-tp3088623p3090931.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list