From: Daniel DeLorme Date: 2007-08-03T19:34:18+09:00 Subject: Re: Determining the common prefix for several strings > El Aug 3, 2007, a las 2:31 AM, Todd Burch escribi�: > >> I have several strings to analyze. The strings are the names of a list >> of things that were once ordered and now are not. A typical array of >> names might look like this: >> >> item001 >> item004 >> item002 >> item002b >> item002C >> item 5 >> item 10 >> itemize this >> >> I want to parse these names and determine that "item" is the common >> prefix. Haha! Regexp magic! list = <<-EOS item001 item004 item002 item002b item002C item 5 item 10 itemize this EOS /\A(.*).*(\n\1.*)*\Z/.match(list)[1] => "item" :-D Daniel