Remove last letter of file name only when 'c'

A swapping-ground for Regular Expression syntax

Remove last letter of file name only when 'c'

Postby hodg100 » Wed Jun 02, 2021 1:14 pm

Hi

First post - did a search but couldn't find exactly what I needed.

I have a bunch of files, most of which end in c.docx. I want to be able to run BRU so that it cleanses the files of the 'c' suffix without removing c's anywhere else.

Any help appreciated :)
hodg100
 
Posts: 2
Joined: Wed Jun 02, 2021 12:58 pm

Re: Remove last letter of file name only when 'c'

Postby Luuk » Wed Jun 02, 2021 2:04 pm

Inside Filters(12) to put a Mask like... *.docx (to only conduct the .docx files).
Inside RegEx(1) to put a checkmark in "v2" with a Match like... c$ (only removes c at the end).
Luuk
 
Posts: 323
Joined: Fri Feb 21, 2020 10:58 pm

Re: Remove last letter of file name only when 'c'

Postby Admin » Thu Jun 03, 2021 2:16 am

Out of interest, one could also use :

Replace (3)
Replace: \end\c
With:

Which replaces a c at the end of the name with nothing.
See more info on Replace in the help file.
Admin
Site Admin
 
Posts: 2059
Joined: Tue Mar 08, 2005 8:39 pm

Re: Remove last letter of file name only when 'c'

Postby Luuk » Thu Jun 03, 2021 4:42 am

Many thanks for the \end\ format inside of Replace(3), I knew about things like \first\, \second\, \third\, \last\, ...
But not the \start\ and \end\ modifiers, so Im always just been using the RegEx(1) instead.
Luuk
 
Posts: 323
Joined: Fri Feb 21, 2020 10:58 pm

Re: Remove last letter of file name only when 'c'

Postby hodg100 » Thu Jun 03, 2021 9:01 am

Thanks very much, both. Can confirm either approach works :)
hodg100
 
Posts: 2
Joined: Wed Jun 02, 2021 12:58 pm


Return to Regular Expressions