I needed to rename all occurrences of a pattern with another, where I knew there was no ambiguous situations. This uses ripgrep, xargs and GNU sed. source.

rg old_pattern --files-with-matches | xargs sed -i 's/old_pattern/new_pattern/g'