Page 1 of 1

Trying to delete digits without changing anything else

PostPosted: Wed Dec 28, 2016 3:18 am
by jhsgalaxy
Hi there,
I am trying to delete only digits appearing after a space using the regex \s\d.
So far BRU does finds what I want it to find.
However, my trouble is what to write into the replace name, I simply want BRU to keep all other characters of the file just as they are, but for some reason, I can't find a solution for that.
Does anybody has an idea?
I.e.:
I have
>>filename series12 2053<<
>>filename series09 20<<
>>filename series17 2053897143<<
and so on
I need to keep >>filename series**<< therefore I used regex "\s\d" to "find" all digits only after a space
Sometimes, the amount of digits at the end of the filename are only 2, sometimes they are 14, sometimes 7 and so on
So I would need an extension to the expression "\s\d" to 'find' all of the digits after the space
And I need whatever I have to write into the field "replace" to keep anything else of the file name; problem here the "filename" may be one word,
but it may also be 2 or 3 or 4 or even more words, therefore "swapping" and then deleting beginning numbers in a second step is no option at all.

Thank you very much in advance and Happy New Year.
JHS

Re: Trying to delete digits without changing anything else

PostPosted: Wed Dec 28, 2016 5:06 am
by therube
Maybe something like this?

Code: Select all
1:RegEx

Match:  (.*?)\s\d+(\D.*)
Replace:  \1\2

Re: Trying to delete digits without changing anything else

PostPosted: Wed Dec 28, 2016 9:36 am
by Emerkamp
Section (5) Remove: is the quickest for just removing digits.

Remove all digits:

Remove (5):
Tick digits

This may leave spaces behind, so double check and take care of them also.

Re: Trying to delete digits without changing anything else

PostPosted: Wed Dec 28, 2016 9:54 am
by KenP
I'm not 100% sure about what you want to do, if you want to delete everything after the series number this will work.
(If you literally want a space after the series number just add a space after "Replace: \1")

RegEx (1)
Match: (.*series\d{2})
Replace: \1


However, if after the digits that you want to delete you have something that you want to keep, such as an episode name, this should work.

RegEx (1)
Match: (.*series\d{2})\s\d*(.*)
Replace: \1\2