By default, other commands separate on all whitespace (spaces and newlines), include spaces in paths. If we use NUL across all commands, we can avoid this
P — Use Perl Regexp (use whatever pat matching syntax is preferred)
{sh} rg -l0 pat dir
l — print file names, not matches
0 — NUL separated
Uses rust ERE (no lookarounds, back references) by default; enable full perl regexp with P
To replace:
{sh} rg -l0 regexp dir | xargs -0 sed 's/find-pat/replace-with-pat/g'