#1 2020-11-11 21:32

Rnmr
Member
Registered: 2019-10-22
Posts: 37

Matching a 'Particular' Space, with more than what is available

In Advanced Renamer program there is an 'instance' dropdown menu that expands beyond just 'all', 'first', and 'last'.
It includes 'all, first, 2nd - 7th, and last'.

Renamer does not have that. I'm guessing there is an easy way to do it directly with RegEx.

So, I want to replace a particular space (with more than available rule options) as ' - '.
How do I find 'space 3 or space 5 or 9, and so on' depending on the need of a particular filename?

Last edited by Rnmr (2020-11-11 21:50)


To be yourself in a world that is constantly trying to make you something else is the greatest accomplishment.
- RWE

Offline

#2 2020-11-11 23:10

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,440

Re: Matching a 'Particular' Space, with more than what is available

Rnmr wrote:

there is an 'instance' dropdown menu that expands beyond just 'all', 'first', and 'last'. It includes 'all, first, 2nd - 7th, and last'.

It sounds like a useful feature.

Rnmr wrote:

I'm guessing there is an easy way to do it directly with RegEx.

Yes, this can be done with the Regular Expressions.

Replace 3rd space:

Expression: \A(.*?\s.*?\s.*?)\s(.*)\Z
Replace: $1 - $2

Input: 1 2 3 4 5 6 7 8 9
Output: 1 2 3 - 4 5 6 7 8 9

Replace 5th space:

Expression: \A(.*?\s.*?\s.*?\s.*?\s.*?)\s(.*)\Z
Replace: $1 - $2

Input: 1 2 3 4 5 6 7 8 9
Output: 1 2 3 4 5 - 6 7 8 9

Offline

#3 2020-11-12 00:28

Rnmr
Member
Registered: 2019-10-22
Posts: 37

Re: Matching a 'Particular' Space, with more than what is available

Ok, thanks!

I was hioping for something where it is just one regex and part of it could be altered/replaced for the particular
space when needed (rather than altered by repetitive tack-ons).

I figured out how to do it with Rearrange rule that has 'around' the same degree of efficiency.

Replace 3rd space:

Exact Pattern of Delimeters: ' | | |'
New Pattern: $1 $2 $3 - $4

Input: 1 2 3 4 5 6 7 8 9
Output: 1 2 3 - 4 5 6 7 8 9

Replace 5th space:

Exact Pattern of Delimeters: ' | | | | |'
New Pattern: $1 $2 $3 $4 $5 - $6

Input: 1 2 3 4 5 6 7 8 9
Output: 1 2 3 4 5 - 6 7 8 9

It would be nice if something like that menu could be implemented.
I have some filenames with music artists/groups at the beginning. They just run into the following words/descriptors
without any division, and obviously the artist/group names will vary in length.

Thanks again!

Last edited by Rnmr (2020-11-12 00:32)


To be yourself in a world that is constantly trying to make you something else is the greatest accomplishment.
- RWE

Offline

#4 2020-11-13 21:53

Rnmr
Member
Registered: 2019-10-22
Posts: 37

Re: Matching a 'Particular' Space, with more than what is available

FYI:
Just a hasty oversight I'm sure, but your '5th space example' only matches up to the 4th space, thus only splitting at the 4th space location.

Last edited by Rnmr (2020-11-13 22:13)


To be yourself in a world that is constantly trying to make you something else is the greatest accomplishment.
- RWE

Offline

#5 2020-11-14 13:16

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,440

Re: Matching a 'Particular' Space, with more than what is available

Rnmr wrote:

Just a hasty oversight I'm sure, but your '5th space example' only matches up to the 4th space, thus only splitting at the 4th space location.

Hmm, it works as intended for me.

Can you demonstrate how it doesn't work for you?

Offline

Board footer

Powered by FluxBB