Remove a spesial part of filename

A swapping-ground for Regular Expression syntax

Remove a spesial part of filename

Postby glennrune » Sun Jan 07, 2018 9:10 am

Hi.


Have filename like this:

2016.11.29 - Monday 29. November - 5. Physics
2016.10.06 - Thursday 6 October - 1. Environmental costs

Want to remove the day number and month from the filename.
Is there a way using regex since there one some occurs dots and some occurs space after day number?

Wants to be:
2016.11.29 - Monday - 5. Physics
2016.10.06 - Thursday - 1. Environmental costs
glennrune
 
Posts: 7
Joined: Thu Dec 28, 2017 4:45 pm

Re: Remove a spesial part of filename

Postby therube » Sun Jan 07, 2018 9:25 pm

1:RegEx
Code: Select all
Match:  (.*)(Monday)(.*-)(.*)
Replace:  \1\2\4

Individual runs, changing (Monday) for each day of the week.
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: Remove a spesial part of filename

Postby glennrune » Mon Jan 08, 2018 8:11 am

therube wrote:1:RegEx
Code: Select all
Match:  (.*)(Monday)(.*-)(.*)
Replace:  \1\2\4

Individual runs, changing (Monday) for each day of the week.



Tanks a lot :)

I needed to change:
"Match: (.*)(Monday)(.*-)(.*)" to "Match: (.*)(Mondy)(.* - )(.*)"
"Replace: \1\2\4" to "Replace: \1\2 - \4"
Now I’m satisfied :lol:
glennrune
 
Posts: 7
Joined: Thu Dec 28, 2017 4:45 pm

Re: Remove a spesial part of filename

Postby glennrune » Mon Jan 08, 2018 9:25 am

Annoter problem:

I need to change a "-" with a" "(only space) without changing " – " in the filename.
When I am using regex I cannot isolate "-" is there a way?
From
2016.11.29 - Monday - 5. Physics-5
2016.10.06 - Thursday – 1-Environmental costs
To:
2016.11.29 - Monday - 5. Physics 5
2016.10.06 - Thursday – 1 Environmental costs
glennrune
 
Posts: 7
Joined: Thu Dec 28, 2017 4:45 pm


Return to Regular Expressions


cron