If I have the following string:
str="hello %%one_boy%%'s something %%four_girl%%'s something more"
how would I edit it to get the following output from printing str:
"hello ONE_BOY's something FOUR_GIRL's something more"
I have been trying to use ‘gsub’ and ‘upcase’ methods but am struggling with the regex to get each word between my ‘%%’ symbols.
The
[^%]+says it will match 1 or more characters except %, and the$1is a global variable that stores the back reference to what was matched.