From: moontoeki@... (Sung Moon) Date: 2002-02-01T12:54:23+09:00 Subject: Re: Newbie question >Subject: Newbie question >From: andrew_queisser@hp.com (andrew queisser) >What's the best way to return a substring that consists of the first 4 >words, if words are comma-delimited, e.g.: > >line = "1,2,3,4,5,6,7" >line.GetFirstFour > >should return > >"1,2,3,4" > try this re = /(|d+,\d+,\d+,\d+)[,|$]/ a = "1,2,3,4,5,6" b = $1 if a =~ re cheers, sungjin moon ------------------------------------------------------------------------- Are you a member of Philanthropic peer-to-peer Program? You can use your IDLE computing time for medical research like Anthrax, Cancer, Alzheimer Disease. More info at http://www.intel.com/cure/download.htm