Thanks, but i need to match the pattern OR don't match anything. "lol1a2vasd".scan(/\d?\w/) => ["l", "o", "l", "1a", "2v", "a", "s", "d"] while i need to be sure that the pattern begins with a regex "x" and ends with "z" (of course, x 1 a 2 b 3 c should be regexes not just chars) thanks, you help is apreciated :) On 7/31/07, Harry Kakueki <list.push / gmail.com> wrote: > On 7/31/07, Alessandro Re <akirosspower / gmail.com> wrote: > > For example, trying with > > "x1A2B3C4Dz".scan /^(x)(\d\w)*(z)$/ > > returns > > [["x", "4D", "z"]] > > while i need something like > > [["x", "1A", "2B", "3C", "4D", "z"]] > > > Hi, > > Try this. > > str = "x1A2B3C4Dz" > p str.scan(/\d?\w/) #>["x", "1A", "2B", "3C", "4D", "z"] > > Harry > > -- > A Look into Japanese Ruby List in English > http://www.kakueki.com/ > > -- ~Ale