Remove pattern from end of line?
Posted: 17 Jul 2008 08:06
Hello all,
I have a list of text lines I want to process, with names like:
Line Example - (junk)
Line Example - [junk]
Line Example [junk]
Line Example (version2) [junk]
I want to reformat these names and remove the last occurrence of any of the following:
[rest of the line
(rest of the line
- rest of the line
So in the list before, I would get 'Line Example' but the last one would preserve 'Line Example (version2)'
I suppose I need something to work backwards from the end of the line, using the first instance of any of the following as a delimiter:
- or ( or [
Can this be done?
thanks,
GF
I have a list of text lines I want to process, with names like:
Line Example - (junk)
Line Example - [junk]
Line Example [junk]
Line Example (version2) [junk]
I want to reformat these names and remove the last occurrence of any of the following:
[rest of the line
(rest of the line
- rest of the line
So in the list before, I would get 'Line Example' but the last one would preserve 'Line Example (version2)'
I suppose I need something to work backwards from the end of the line, using the first instance of any of the following as a delimiter:
- or ( or [
Can this be done?
thanks,
GF