I am assuming the pipe (vertical bar) is your field separator.
This is just like any other HL/7 separator – it should never be a part of the data.
Obviously the sending system should deploy the escape technique clearly defined in the HL/7 standard.
Just as obviously the sending system is not an more than likely is unaware of standard and unwilling to change.
So – many different mechanisms have been proposed by many others on this forum to handle the imbedded sub-component (&) separator.
A search for & will probably get you almost all of the discussions surrounding this topic along with some proposed solutions. You can evaluate the various proposed solutions to see if they will fit for your situation.
Personally I feel there is only one valid, never fail solution and that is to get the sending system to comply.
I think the field separator (pipe or vertical bar) will be more difficult to manage than the sub-component separator (&).