how to define Regex to find Each repeating string in a link till the closest preceding character?

how to define Regex to find Each repeating string in a link till the closest preceding character?

I have the link,

http://www.mainlink.com/subcategory/?q=Type%x32|Size%undefined|yollo™Aundefined


For the link, how to get each "undefined" from the link and for every instance of "undefined" get all the characters from "undefined" to the closest "|"(separator) preceding that undefined and replace with "".


Is this even possible?