truncating names starting at a string (inclusive)

A swapping-ground for Regular Expression syntax

truncating names starting at a string (inclusive)

Postby APJ » Mon Dec 01, 2008 8:19 am

Hi, I use ViceVersa, another beautiful product..
when using the archive function however, it saves the resulting files with a suffix in the form of...
Project_Event(2008) Calender09.xls_(2008-11-28_00-25-08_OVE_T).xls as a bogus example
Project_Event(2008) Calender09.mxls_(2008-11-28_00-25-08_OVE_T).mxls as another with a longer extension.
(just to insert the spanner for those contemplating a character count!!)

anyway, I want to be able to truncate these file names by say specifying the unique string _(2008) inclusive of string.
end result above being

Project_Event(2008) Calender09.xls
Project_Event(2008) Calender09.mxls

sounds easy eh.. anyone know what switches, options, syntax, breed of rabbits foot.. I need to use to do this??
If you could use the Remove/crop,special and it take the entire string... but it seems to target just the first char '_'
I'm sure there are many other ViceVersa advocates who need this process as a recovery aid.
Hope I'm just missing something..
thanks in advance
AJ
APJ
 
Posts: 2
Joined: Mon Dec 01, 2008 7:59 am

Re: truncating names starting at a string (inclusive)

Postby jimwillsher » Mon Dec 01, 2008 11:57 am

Suggest you use a RegExp along the lines of:

(.*)(_\(2008)(.*)

\1\2


I've not tested it, but hopefully you get the idea.



Jim
jimwillsher
 
Posts: 63
Joined: Wed Sep 24, 2008 1:22 pm

Re: truncating names starting at a string (inclusive)

Postby APJ » Fri Dec 05, 2008 2:09 am

Jim, thankyou so much..
RegEx (1)
(.*)(_\(2008)(.*)
\1\2

this left the suffix of _(2008 still attached
so I also added
Repl. (3)
_(2008

This has cleaned them all back to their original names perfectly..
thanks again
AJ
APJ
 
Posts: 2
Joined: Mon Dec 01, 2008 7:59 am


Return to Regular Expressions