On Sun, Mar 16, 2008 at 6:37 PM, Adam Akhtar <adamtemporary / gmail.com> wrote:
> great, closer to solving my problem. Though i realised that this regex
>  wouldnt work if the marked text was split by a newline so i went away
>  and modified it so that if it were split it would still be picked up. I
>  did it with this
>
>  \({2}(?s)(.*?)(?s)\){2}
>
>  Im wondeirng if theres a neater way of sayinig "ignore any newlines that
>  split the marked text up"
>
>  is there an operator that tells it to ignore newlines and is the above
>  robust?

I don't know about robustness, but throwing an 'm' after the regex
like Xavier did might do the trick...

(str.scan /\({2} (.*?) \){2}/mx).flatten

...which could also be written as...

str.scan(/\({2} (.*?) \){2}/mx).flatten

If you are worried about spaces on either side of the

Notice the m and x after the last forward slash.  If you are concerned
about there being spaces on either side of the string between (( and
)), then...

str.scan(/\{2} \s*(.*?)\s* /){2}/mx).flatten

Todd