From: Matthew Moss Date: 2006-05-06T04:51:39+09:00 Subject: Re: Newbie question What he's saying is that he wants both "&Edit" and "Vi&ew" to show up because both have an 'e' after the ampersand. I take it these are identifiers for Windows menus or the like, so the character after the ampersand has to be unique within a particular set. On 5/5/06, James Edward Gray II wrote: > On May 5, 2006, at 2:06 PM, Kyle Alons wrote: > > > James Gray wrote: > >>>> ["&abc", "a&cb", "b&ac", "ccc", "cb&a"].grep(/&../) > >> => ["&abc", "a&cb", "b&ac"] > >> > >> Hope that helps. > > > > That's not quite it. That seems to match all strings containing an > > ampersand followed by 2 other characters. What I need is all strings > > that have duplicate characters following an & (&a in the above). > > Something a little more concrete: > > > > ["&File", "&Edit", "Vi&ew", "P&roject", "T&ree", "Favo&rites", > > "&Help"] > > > > would return > > > > ["&Edit", "Vi&ew", "P&roject", "T&ree", "Favo&rites"] > > > > (&e and &r are found multiple times). > > No letters are duplicated in "&Edit". > > I clearly don't understand your goal, but you solve it like this: > > array_of_strings.select do |string| > # put test against string here... > end > > Sorry I am not more help. > > James Edward Gray II > >