Regex: How do you capture one group among multiple groups using regex? (in ruby)
I have two groups of text:

    firstgroup
    (some content)
    endgroup
    
    
    secondgroup
    (some content)
    endgroup


I'm trying to just capture the first group (not the second group). I'm using this regular expression:

    firstgroup(.|\n)*endgroup

For some reason, that regular expressions selects both first group and second group (probably because it looks at the very last "endgroup" above). Is there a way to modify my regex such that I only select the first group (and not the second group)?
Regex: How do you capture one group among multiple groups using regex? (in ruby)
===

I have two groups of text:

    firstgroup
    (some content)
    endgroup
    
    
    secondgroup
    (some content)
    endgroup


I'm trying to just capture the first group (not the second group). I'm using this regular expression:

    firstgroup(.|\n)*endgroup

For some reason, that regular expressions selects both first group and second group (probably because it looks at the very last "endgroup" above). Is there a way to modify my regex such that I only select the first group (and not the second group)?