Mask to insert space counting from end of filename

English support forum

Moderators: Hacker, petermad, Stefan2, white

User avatar
spikey
Member
Member
Posts: 123
Joined: 2005-07-20, 08:37 UTC

Mask to insert space counting from end of filename

Post by *spikey »

What mask in the Multi Rename Tool will put a space before the last 3 characters of a filename?

For example:

house123 ---> house 123
apartment999 ---> apartment 999
User avatar
Wilhelm M.
Power Member
Power Member
Posts: 1054
Joined: 2003-06-05, 10:45 UTC

Re: Mask to insert space counting from end of filename

Post by *Wilhelm M. »

Perhaps [N1--4] [N-3,3] does the job? Don't forget the blank between the brackets.
Grüße/Regards,
Wilhelm
User avatar
spikey
Member
Member
Posts: 123
Joined: 2005-07-20, 08:37 UTC

Re: Mask to insert space counting from end of filename

Post by *spikey »

That's great,thank you. I can't manage to puzzle out the way it works (even using the syntax shown on the help page) but when I get a clear-headed moment I must study it and learn!

I have a related question, if you're able to help ...

I name a set of picture files named by using with a subject description followed by a sequence number. After that I sometimes add the exclamation symbol to selected pictures as a form of rating. Sometimes I might use two exclamation symbol or even three. It looks like this (there's a space before the exclamation symbols and a space after).

the house on the hill 001.jpg
the house on the hill 002 ! .jpg
the house on the hill 003 !! .jpg
the house on the hill 004 !!! .jpg

As part of editing, I will delete photos which makes sequence is non-linear. See here:

the house on the hill 001.jpg
the house on the hill 002 ! .jpg
the house on the hill 004 !!! .jpg

Is there a way for TC to re-apply the sequence numbers?

I could do this for one set of files by counting the number of characters from the start of the file name but I would like to be able to do this for any set of files with any description. Perhaps this can be done by counting from the end while ignoring the exclamation symbols -- but how? Is it possible?

Thanks for any information.
Last edited by spikey on 2020-07-15, 17:58 UTC, edited 1 time in total.
User avatar
Wilhelm M.
Power Member
Power Member
Posts: 1054
Joined: 2003-06-05, 10:45 UTC

Re: Mask to insert space counting from end of filename

Post by *Wilhelm M. »

I guess you have mixed up your example - both lists show the same filenames. But I think I understand anyway.

Try [N1-22][C][N26-]. The [N1-22] keeps the part that should not be changed. Then insert the counter (3 digits) and then the rest of the name that also should remain unchanged. In your example this rest is character 26 till the end of the name [N26-].

Hope that works. It's just a trial-and-error affair for me - same as for you.
Grüße/Regards,
Wilhelm
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Mask to insert space counting from end of filename

Post by *Stefan2 »

Here I am showing my way of doing this.

FROM:
the house 235 on the hill001.jpg
the house 235 on the hill002 ! .jpg
the house 235 on the hill004 !!! .jpg
the house 333 ! on the hill002 !.jpg
the house 333 ! on the hill002 ! - Copy.jpg

TO:
the house 235 on the hill 001.jpg
the house 235 on the hill 002 ! .jpg
the house 235 on the hill 004 !!! .jpg
the house 333 ! on the hill 002 !.jpg
the house 333 ! on the hill002 ! - Copy.jpg




Using Regular Expressions


Search for: ^(.+?)(\d\d\d[\s!]*)$
Replace with: $1 $2
☐⩟ ☐1x   ☐[E] ☑RegEx   ☐Subst




Explanation:
^ -------- match at start
(.+?) ---- match everything but non-greedy, and store in $1
(\d\d\d -match next three digits, and
[\s!]*) -- an Space or !, null-or-more times, and store all together in $2
$ -------- match all this at the end of the string

So matching three digits and following one-or-more space or exclamation mark at the end.
Replace with the matched parts and add the wanted space yourself between $1 and $2.

You can also equivalent "Search for:"
^(.+?)(\d\d\d[ !]*)$
or
^(.+?)(\d{3}[ !]*)$



 
User avatar
spikey
Member
Member
Posts: 123
Joined: 2005-07-20, 08:37 UTC

Re: Mask to insert space counting from end of filename

Post by *spikey »

Wilhelm M. wrote: 2020-07-15, 10:00 UTC I guess you have mixed up your example - both lists show the same filenames. But I think I understand anyway.

Try [N1-22][C][N26-]. The [N1-22] keeps the part that should not be changed. Then insert the counter (3 digits) and then the rest of the name that also should remain unchanged. In your example this rest is character 26 till the end of the name [N26-].

Hope that works. It's just a trial-and-error affair for me - same as for you.
Hi Wilhelm. You're right I messed up my example. I have gone back and corrected it now.

Your solution requires me to count the number of characters from the beginning of the file name but the description part (before the number and the exclamation sign) will change from one set of photos to another. I would like to avoid doing this count for every set.
User avatar
spikey
Member
Member
Posts: 123
Joined: 2005-07-20, 08:37 UTC

Re: Mask to insert space counting from end of filename

Post by *spikey »

Stefan2 wrote: 2020-07-15, 11:30 UTC Here I am showing my way of doing this.
Some of the characters after you wrote "replace with" (and the line following) don't display up on my browser.

I can't see exactly what you have written.
User avatar
Wilhelm M.
Power Member
Power Member
Posts: 1054
Joined: 2003-06-05, 10:45 UTC

Re: Mask to insert space counting from end of filename

Post by *Wilhelm M. »

@stefan2
The same here. I only see

Search for: ^(.+?)(\d\d\d[\s!]*)$
Replace with: $1 $2
☐⩟ ☐1x ☐[E] ☑RegEx ☐Subst

Surely you didn't want it to look like this. Besides, this sometimes happens with your postings . Why?
Grüße/Regards,
Wilhelm
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Mask to insert space counting from end of filename

Post by *Stefan2 »

Hi!

Whit which browser do you have problems to see the whole post?

- - -

You say you don't see this following in my post above?

---------8<--------------snip----------8<---------
Explanation:
^ -------- match at start
(.+?) ---- match everything but non-greedy, and store in $1
(\d\d\d -match next three digits, and
[\s!]*) -- an Space or !, null-or-more times, and store all together in $2
$ -------- match all this at the end of the string

So matching three digits and following one-or-more space or exclamation mark at the end.
Replace with the matched parts and add the wanted space yourself between $1 and $2.

You can also equivalent "Search for:"
^(.+?)(\d\d\d[ !]*)$
or
^(.+?)(\d{3}[ !]*)$
--------->8--------------snip---------->8---------



- - -

the whole post from above:
Stefan2 wrote: 2020-07-15, 11:30 UTC START
Here I am showing my way of doing this.

FROM:
the house 235 on the hill001.jpg
the house 235 on the hill002 ! .jpg
the house 235 on the hill004 !!! .jpg
the house 333 ! on the hill002 !.jpg
the house 333 ! on the hill002 ! - Copy.jpg

TO:
the house 235 on the hill 001.jpg
the house 235 on the hill 002 ! .jpg
the house 235 on the hill 004 !!! .jpg
the house 333 ! on the hill 002 !.jpg
the house 333 ! on the hill002 ! - Copy.jpg




Using Regular Expressions


Search for: ^(.+?)(\d\d\d[\s!]*)$
Replace with: $1 $2
☐⩟ ☐1x   ☐[E] ☑RegEx   ☐Subst




Explanation:
^ -------- match at start
(.+?) ---- match everything but non-greedy, and store in $1
(\d\d\d -match next three digits, and
[\s!]*) -- an Space or !, null-or-more times, and store all together in $2
$ -------- match all this at the end of the string

So matching three digits and following one-or-more space or exclamation mark at the end.
Replace with the matched parts and add the wanted space yourself between $1 and $2.

You can also equivalent "Search for:"
^(.+?)(\d\d\d[ !]*)$
or
^(.+?)(\d{3}[ !]*)$



END


 
User avatar
Wilhelm M.
Power Member
Power Member
Posts: 1054
Joined: 2003-06-05, 10:45 UTC

Re: Mask to insert space counting from end of filename

Post by *Wilhelm M. »

Firefox, PaleMoon, Opera ... you name it. In my opinion this problem has nothing to do with the browsers.

Here a copy from your last post:

Replace with: $1 $2
☐⩟ ☐1x ☐[E] ☑RegEx ☐Subst

Always the same.
Grüße/Regards,
Wilhelm
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Mask to insert space counting from end of filename

Post by *Stefan2 »

Don't know why. I see it with PaleMoon, IE and Chrome and on two PCs.

Here is an picture of my post (will expire in one day)
https://ibb.co/br1Fqsw


 
User avatar
Hacker
Moderator
Moderator
Posts: 13144
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Re: Mask to insert space counting from end of filename

Post by *Hacker »

Works fine on Firefox and the Black forum style.

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
Usher
Power Member
Power Member
Posts: 1727
Joined: 2011-03-11, 10:11 UTC

Re: Mask to insert space counting from end of filename

Post by *Usher »

Wilhelm M. wrote: 2020-07-15, 20:33 UTC Firefox, PaleMoon, Opera ... you name it. In my opinion this problem has nothing to do with the browsers.
It seems that you have some problems with font cache or fonts themselves. What Windows do you use?
Wilhelm M. wrote: 2020-07-15, 20:33 UTC Replace with: $1 $2
☐⩟ ☐1x ☐[E] ☑RegEx ☐Subst
I can see both copied lines in Firefox 52 and IE8 in Windows XP when opening the forum in its default style.
Last edited by Usher on 2020-07-16, 12:59 UTC, edited 1 time in total.
Andrzej P. Wozniak
Polish subforum moderator
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Mask to insert space counting from end of filename

Post by *Stefan2 »

Stefan2 wrote: 2020-07-15, 11:30 UTC Here I am showing my way of doing this.
2spikey
2Wilhelm M.

Those of you who doesn't see my above post entirely, may you please upload
an screenshot of what you see to some external hoster and post the URL here?



 
User avatar
spikey
Member
Member
Posts: 123
Joined: 2005-07-20, 08:37 UTC

Re: Mask to insert space counting from end of filename

Post by *spikey »

Stefan2 wrote: 2020-07-16, 08:20 UTCThose of you who doesn't see my above post entirely, may you please upload an screenshot of what you see to some external hoster and post the URL here?
Here's a screenshot of the problem as requested. Please excuse the hosting site's banners. I have added only the arrow but not the blue coloring shown. https://ibb.co/R41bnrD

Back to the main matter .... I can't manage to use the regex you gave. I copied and pasted it into the "SEARCH FOR" box in the "SEARCH AND REPLACE" section of the Multi-Rename Tool, and then I checked the "REGEX" box. I entered some dummy characters in the "REPLACE WITH" box.

However this didn't do anything. I also tried using the two regexes you gave at the end but with no success.

Am I doing this right? I don't understand where your $1 and $2 comes into it, perhaps on account of the problem we're discussing to do with seeing that line in your post.
Post Reply