From: Ahmet Kilic Date: 2009-09-02T22:26:25+09:00 Subject: Re: regex issue confusing Brian Candler wrote: > Ahmet Kilic wrote: >> This is OK >> line[/\sclass\s(\w+)/, 1] >> but >> line[/\s#include\s(\w+)/, 1] >> this is not. >> >> why??? please help. > > "Not OK" by what definition? > > Try posting an irb transcript which demonstrates your problem with > sample data. It looks OK to me: > >>> line = "foo #include bar baz" > => "foo #include bar baz" >>> line[/\s#include\s(\w+)/, 1] > => "bar" >>> sorry it was my fault, i did not recognize "" this. I corrected it. irb(main):040:0> line = "foo #include \"bar\" baz" irb(main):043:0> line[/\s#include\s(\"\w+)/, 1] => "\"bar" thank you very very much. -- Posted via http://www.ruby-forum.com/.