I am not a regex specialist, so I need some help with this. I have a text file, and I need to remove some trailing delimiters. The text file looks like this:
MSH|^~\&|OAZIS||||20101029135359||ADT^A31|00000015|P|2.3.1||||||ASCII
EVN|A31|20101029135359^^^^||||19900101
So I think the best way is to do a Regex replace? Can anyone help me with this regex?
I want to remove all ^
that come before a |
So test^A^^|
has to become test^A|
Thanks
resultString = Regex.Replace(subjectString, @"\^+\|", "|");
should take care of that.
I belive your regular expression would look like this...
\^+\|
That should match one ore more '^' followed by a '|'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With