search from end of line? or (remove after last delimiter)
Posted: Mon Nov 02, 2009 5:29 pm
I would like to remove all (if any) characters after a delimiter at the end of the line.
The file structure is like this...
data1|data2|data...| comment
So, I need to remove all characters after the last "|"
There are a couple strategies that I thought about. I don't know if there is a way to find the first occurrence of a character FROM the end of the line, this would be the preferred solution. Another approach would be to search for the number of occurrences of "|" and cut the valid data up to it, but I thought probably Regex would have a simple one line solution.
Thanks for the help, Jan Zumwalt
The file structure is like this...
data1|data2|data...| comment
So, I need to remove all characters after the last "|"
There are a couple strategies that I thought about. I don't know if there is a way to find the first occurrence of a character FROM the end of the line, this would be the preferred solution. Another approach would be to search for the number of occurrences of "|" and cut the valid data up to it, but I thought probably Regex would have a simple one line solution.
Thanks for the help, Jan Zumwalt