I wonder how to replace specific element (even though repeated) within sublists of a nested list with multiple elements while maintaining the list structure. Suppose the following:
{{{{O1, 2, 22, 24, 6, PoP1, 5, 23, 27, 17, PoP2, 18, 28, 14, D1}, {O1,
1, 21, 23, 5, PoP1, 6, 24, 28, 18, PoP2, 17, 27, 13, D1}, {O1, 2,
22, 24, 6, PoP1, 5, 23, 27, 17, PoP2, 18, 28, 14, 13, D1}, {O1,
2, 22, 21, 23, 5, PoP1, 6, 24, 28, 18, PoP2, 17, 27, 13, D1}, {O1,
2, 1, 21, 23, 5, PoP1, 6, 24, 28, 18, PoP2, 17, 27, 13, D1}, {O1,
1, 21, 23, 5, PoP1, 6, 24, 28, 18, PoP2, 17, 27, 13, 14,
D1}, {O1, 1, 21, 22, 24, 6, PoP1, 5, 23, 27, 17, PoP2, 18, 28, 14,
D1}, {O1, 1, 2, 22, 24, 6, PoP1, 5, 23, 27, 17, PoP2, 18, 28, 14,
D1}, {O1, 2, 22, 21, 23, 5, PoP1, 6, 24, 28, 18, PoP2, 17, 27,
13, 14, D1}, {O1, 2, 1, 21, 23, 5, PoP1, 6, 24, 28, 18, PoP2, 17,
27, 13, 14, D1}, {O1, 2, 1, 21, 22, 24, 6, PoP1, 5, 23, 27, 17,
PoP2, 18, 28, 14, D1}, {O1, 1, 21, 22, 24, 6, PoP1, 5, 23, 27, 17,
PoP2, 18, 28, 14, 13, D1}, {O1, 1, 2, 22, 24, 6, PoP1, 5, 23, 27,
17, PoP2, 18, 28, 14, 13, D1}, {O1, 1, 2, 22, 21, 23, 5, PoP1, 6,
24, 28, 18, PoP2, 17, 27, 13, D1}, {O1, 2, 1, 21, 22, 24, 6,
PoP1, 5, 23, 27, 17, PoP2, 18, 28, 14, 13, D1}, {O1, 1, 2, 22, 21,
23, 5, PoP1, 6, 24, 28, 18, PoP2, 17, 27, 13, 14, D1}}}}
I would like to substitute PoP1 with XXX,YYY,ZZZ and PoP2 with SSS,FFF while having the same list depth and sublists. I have tried with /. but it introduces a new sublist like :
{{{{O1, 2, 22, 24, 6, {XXX, YYY, ZZZ}, 5, 23, 27, 17, {SSS, FFF},
18, 28, 14, D1}, {O1,...
Sequence
. $\endgroup$