I have the regex expression "myname"(?:(?:.*\n)+).*tree_ish = "(.*)",
, that works fine for itself (tested in https://regex101.com/) with:
name = "myname",
dummy1 = 2345,
dummy2 = "dummy",
tree_ish = "bc59c4f7c7cf4d0b969a3f405a4a5b7fee22ae96",
Now I want to use that regex expression in sed to replace the one captioning group but cannot figure out the proper escaping. I tried to escape all \().*+
but somehow neither permutation did work. And sadly using sed is not as easy as:
sed -i 's|"myname"(?:(?:.*\n)+).*tree_ish = "(.*)",|rEpLaCe|' myfile
Does anyone know what the correct escaping would look like for replacing bc59c4f7c7cf4d0b969a3f405a4a5b7fee22ae96
with rEpLaCe
?
Expected output:
name = "myname",
dummy1 = 2345,
dummy2 = "dummy",
tree_ish = "rEpLaCe",