Concept Flow - Gsub with regex
Start with original string
Apply gsub with regex
Match regex pattern in string?
No→Return modified string
Yes
Replace matched part
Continue to next match
↩Back to Match regex pattern
The program starts with a string, applies gsub with a regex to find matches, replaces each match, and continues until no matches remain, then returns the new string.