anon1m0us wrote: > I need to obtain the group name From after CN= until the first comma. > I tried scan and match. I can't get it right. I'm not sure I understand you correctly, but is this what you're looking for: irb(main):008:0> mystring = "CN=test,blasdhlfkasjdlfjkCN=test1,balkjdf" => "CN=test,blasdhlfkasjdlfjkCN=test1,balkjdf" irb(main):009:0> mystring.scan(/CN=([^,]*),/) => [["test"], ["test1"]] -Drew -- Posted via http://www.ruby-forum.com/.