From: Bertram Scharpf Date: 2005-01-30T04:24:02+09:00 Subject: Re: string extraction Hi, Am Samstag, 29. Jan 2005, 16:05:57 +0900 schrieb Navindra Umanee: > I have strings of the form: > > string='.///root/1068663688//1068824962/1068836207//1068932537///' > > Basically, I want to extract the last number in the string. > > string[/(\d*)\/*$/].delete('/') > > But I've already matched the digit I want, so the delete is just > superfluous work. How can I extract the number without doing a > separate delete? Maybe you simply need to say string[/\d+\/*$/].to_i that doesn't mind trailing slashes. Bertram -- Bertram Scharpf Stuttgart, Deutschland/Germany http://www.bertram-scharpf.de