name="(this is
a message
)
(other message)";
res=name.scan(/(\(.*\))/m);
puts res.join("###");
In the above code,I want to extract the matched parenthesis with the text inside the it as a whole expresstion.
I mean I want to get the following result through my code:
(this is
a message
)###(other message)
That's to say,the length of the res should be 2 not 1, But in my code,I always get:
(this is
a message
)
(other message)
There must be something wrong with my pattern,can any one help me to fix it?