Use the string.scanfunction instead string.gsubto capture the desired line.
> "sign me up for LUNCH".scan(/\b[A-Z]+\b/)[0]
=> "LUNCH"
\b called the word boundary, which coincides between the word symbol and a symbol other than the word.
OR
> "sign me up for LUNCH".scan(/(?<!\S)[A-Z]+(?!\S)/)[0]
=> "LUNCH"
(?<!\S) A negative lookbehind that claims that a non-spatial character will not precede a match.[A-Z]+ .(?!\S) , , .