That solution is wrong.
What if the string contains a newline? Or multiple newlines? Anything that follows after the newline will not be removed.
I could suggest using s/...//s but I'm not going to do that. This code will be slower then it has to be - and it doesn't give the information you want. It just starts removing text from a | until a newline.
My suggestion is the same as ysth's: Re: Removing digits until you see | in a string
In reply to Re^2: Removing digits until you see | in a string
by Animator
in thread Removing digits until you see | in a string
by kevyt
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |