On 12 Mar 2006, at 09:58, Dan Kohn wrote: > You'll generally get a better answer if you include an example in your > question. Also, that link didn't work. > > If you're asking how to apply two regexps, you can use the scan method > to get the results in arrays, and then intersect them with &. > > string ="hello world"; puts string.scan(/.../) & string.scan(/..l/) I think he's trying to do this... If you have a regular expression, R, then there is a (potentially infinite) set S(R) of input strings that it will match. Given two regular expressions, R1 and R2, you can find the strings that match either regular expression: S(R1) & S(R2) He now wants to find a regular expression Ri such that: S(Ri) = S(R1) & S(R2) And he's looking for an algorithm that will calculate Ri given R1 and R2. I think :) Given, say: R1 = /hell/ R2 = /ello/ then I think that Ri = /hello/ :) It could, perhaps, be a ruby quiz.