From: "Michael W. Ryder" <_mwryder@...> Date: 2007-06-12T16:25:08+09:00 Subject: Re: extracting numbers from a string Matt Jones wrote: > I have filenames from various digital cameras: DSC_1234.jpg, > CRW1234.jpg, etc. What I really want is the numeric portion of that > filename. How would I extract just that portion? > > > I expect it to involve the regex /\d+/, but I'm unclear how to extract a > portion of a string matching a regex. > > Thank you > a = "DSC_1234.jpg" b = a.gsub(/[^[:digit:]]/, '')