MultiRename a series of files with regex

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
louwin
Member
Member
Posts: 112
Joined: 2007-06-09, 11:22 UTC
Location: Perth, Western Australia

MultiRename a series of files with regex

Post by *louwin »

I have a series of files named like....

Name Surname Word Word Word .... and I want to insert " - " between "Surname" and first "Word" thus....

Name Surname - Word Word Word .... there could many "Word"s in the name

Using regex

TIA

i tried

.* .* .*

$1 $2 - $3
Last edited by louwin on 2024-02-12, 01:01 UTC, edited 1 time in total.
There are 10 types of people in the world,
Those who understand binary and those who don't.
Fla$her
Power Member
Power Member
Posts: 2318
Joined: 2020-01-18, 04:03 UTC

Re: MultiRename a series of files with regedit

Post by *Fla$her »

louwin wrote: 2024-02-11, 01:13 UTC Using regedit
RegEx.

Search for: '(?<=^\S+ \S+)'
Replace with: ' -'
Last edited by Fla$her on 2024-02-11, 04:46 UTC, edited 4 times in total.
Overquoting is evil! 👎
User avatar
louwin
Member
Member
Posts: 112
Joined: 2007-06-09, 11:22 UTC
Location: Perth, Western Australia

Re: MultiRename a series of files with regedit

Post by *louwin »

Wow! I whole lot more complex than I expected but THANKS :D

BTW - your solution puts a "-" after the name but I can fix that with another simple edit :) :) :)

(Sorry about the RegEx(edit) :( )
There are 10 types of people in the world,
Those who understand binary and those who don't.
User avatar
louwin
Member
Member
Posts: 112
Joined: 2007-06-09, 11:22 UTC
Location: Perth, Western Australia

Re: MultiRename a series of files with regedit

Post by *louwin »

Again.... Sorry but your solution inserts the "-" after EVERY second words :(
There are 10 types of people in the world,
Those who understand binary and those who don't.
Fla$her
Power Member
Power Member
Posts: 2318
Joined: 2020-01-18, 04:03 UTC

Re: MultiRename a series of files with regedit

Post by *Fla$her »

louwin wrote: 2024-02-11, 03:20 UTC your solution puts a "-" after the name
It's placed after the second word:
louwin wrote: 2024-02-11, 01:13 UTC Name Surname - Word Word Word .... there could many "Word"s in the name

louwin wrote: 2024-02-11, 03:24 UTC after EVERY second words
This is a bug. I've been wanting to discuss it for a long time, but I'm still collecting other examples. I added ^ in the original example to avoid this.
Overquoting is evil! 👎
User avatar
white
Power Member
Power Member
Posts: 4623
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: MultiRename a series of files with regedit

Post by *white »

louwin wrote: 2024-02-11, 03:20 UTC (Sorry about the RegEx(edit) :( )
You can edit your first post and change the subject (this changes the topic title) and contents of the post. Please do so to make it less confusing :)
User avatar
louwin
Member
Member
Posts: 112
Joined: 2007-06-09, 11:22 UTC
Location: Perth, Western Australia

Re: MultiRename a series of files with regex

Post by *louwin »

Perfect! THANKS.... :D
There are 10 types of people in the world,
Those who understand binary and those who don't.
Post Reply