From: "Jan E." Date: 2012-05-02T21:26:51+09:00 Subject: Re: array of strings - finding letter combinations Sebastjan H. wrote in post #1059226: > Hi Jan, > > thank you so much for this. I went through the code and I think I > understand most of it. I am only having hard time understanding the > beginning: > >> str = 'abc&exyz' >> str[/(?<=&)[a-z]/] > > What do these two lines define. I guess the second one is the regex, > what about the first one. And moreover, how are these two related? The first line simply defines a test string of the format you described in your first post (it contains the combination "&e"). The other characters are just gibberish to show that the substring is found inpedendent of the position or whatever. The regex basically says: Look for a lowercase letter from a to z, which is preceeded by an ampersand. Using this regex in the "[]" method will return the first matching substring (or character in this case). -- Posted via http://www.ruby-forum.com/.