fix: greedy renaming (closes #237)

This commit is contained in:
Thomas Lambert
2023-03-29 21:53:21 +02:00
parent 78de46aa5b
commit 29f80e3abc

View File

@@ -330,17 +330,18 @@ local function recursive_substitution(dir, old, new)
sedcommand = "sed -i ''" sedcommand = "sed -i ''"
end end
-- 's|\(\[\[foo\)\([]#|\]\)|\[\[MYTEST\2|g'
local replace_cmd = "rg -0 -l -t markdown '" local replace_cmd = "rg -0 -l -t markdown '"
.. old .. old
.. "' " .. "' "
.. dir .. dir
.. " | xargs -0 " .. " | xargs -0 "
.. sedcommand .. sedcommand
.. " 's|" .. " 's|\\("
.. old .. old
.. "|" .. "\\)\\([]#|]\\)|"
.. new .. new
.. "|g' >/dev/null 2>&1" .. "\\2|g' >/dev/null 2>&1"
os.execute(replace_cmd) os.execute(replace_cmd)
end end