I would like to use Ruby's gsub to replace text except those inside a specific delimiter, like this:
regex = /(.+?)(@.+?@)(.+?)/
text = "aaa@xxx@bbb aaa@xxx@bbb"
text.gsub(regex){"#{$1.upcase}#{$2}#{$3.upcase}"}
I would like the return value to be AAA@xxx@BBB AAA@xxx@BBB, but it is AAA@xxx@BBB AAA@xxx@Bbb.