From: "Jan E." Date: 2012-05-03T04:59:34+09:00 Subject: Re: array of strings - finding letter combinations Sebastjan H. wrote in post #1059285: > Ok, thx. Just so I understand correctly, these two lines are just > examples and are not part of the actual code. Since the array of strings > to be searched in is actually strings in the code below. Right? Yes. > Furthermore, when I used the regex as you put it, I got this error: >> duplicates.rb:5: undefined (?...) sequence: /(?<=&)[a-z]/ > > So I changed it to /&[a-z]/ and the error was gone. Yes, but this regex will include the ampersand. To get the actual letter, you have to write something like str[/&[a-z]/][1]. Anyway, you should definitely update your Ruby, if possible. Version 1.8 is more or less dead. > I also putsed the used_chars and duplicates to check it and it's not > clear to me why the puts duplicates returns: a 3. Is 3 the index? Yes, but you might as well save the actual strings in the array. -- Posted via http://www.ruby-forum.com/.