The preceding element will be matched one or more times. The non-greedy version will match only one version if possible. Unlike the *? quantifier, the +? quantifier does not have to be sandwiched in order to make sense. If it is the quantifier of the last element in the regex, it will simple match one of that element.
text = "!foo!bar!baz!"
# This will match the entire <a href="/od/glossary/g/string.htm">string</a>
# and replace it with "X"
puts text.sub( /.+!/, "X" )
# This will match only !foo! and print
puts text.sub( /.+?!/, "X" )