Magic Replace Text REGex, remove anything outside of delimiters
I am trying to use the regex replace text in magic and am having difficulty getting the desired result. I need to capture a string between two delimiters and delete everything else.
An example being:
"EM|CX-001|Test Campaign Name" and grabbing only "CX-001". I cannot use a substring as the number of characters before the pipe and after the pipe may change.
I tried using the regex (?<=\|)(.*?)(?=\-), but while this selects CX-001, the replace text in magic would remove it instead of removing everything else.
Any regex people able to help?