#1 2020-05-17 17:09

JPhilippe
Member
Registered: 2020-05-17
Posts: 2

Change "Badla [2019]" to "2019 - Badla"

Hello,

I would like to change the following

Badla [2019]
Beautiful Boy [2019]
Black Mirror Bandersnatch [2018]
Cam [2018]
Can You Ever Forgive Me [2019]

to

2019 - Badla
2019 - Beautiful Boy
2018 - Black Mirror Bandersnatch
2018 - Cam
2019 - Can You Ever Forgive Me

Should I really have to make it through any regEx, and so, how...?
Thanks in advance, JPhilippe

Offline

#2 2020-05-17 19:53

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,046

Re: Change "Badla [2019]" to "2019 - Badla"

Hi and welcome.


FROM:
Black Mirror Bandersnatch [2018]

TO:
2018 Black Mirror Bandersnatch


Try Rearrange rule:
http://www.den4b.com/wiki/ReNamer:Rules:Rearrange


Split using delimiters "["
New pattern "$2 - $1"
[x] skip extension

The split name parts are stored into variables $1, $2, ....
In the replacement we just rearrange the matched parts (and add here your wanted hyphen).
Results in "2018] - Black Mirror Bandersnatch"
The remaining "]" you can delete by an second rule.



But you can also split by "]" too in the same time, by separate two search strings by an pipe '|'
Split using delimiters "[|]"
New pattern "$2 - $1"
[x] skip extension

Results in "2018 - Black Mirror Bandersnatch"
Since the search delimiter(s) are removed from the result, this trick seems to work fine.
Help says: "If the delimiter occurs at the very beginning of the name, the resultant $1
contains nothing (because there is nothing on the left side of the delimiter)."

The same seems to be true if an delimiter match at the very end of an string (the name).



EDIT:
This very issue is also covered by that example
http://www.den4b.com/wiki/ReNamer:Rules … Example_13

 

Last edited by Stefan (2020-05-17 20:07)


Please see HELP and MANUAL in Wiki for more info.
If ReNamer had helped you, please donate a coin to Denis or buy a Pro license for commercial use. (Lite vs Pro)

Offline

#3 2020-09-15 13:26

JPhilippe
Member
Registered: 2020-05-17
Posts: 2

Re: Change "Badla [2019]" to "2019 - Badla"

Dear Stefan,
Thank you so much for your up answer, it helped me so much!

Now I have another issue, I quickly tried to find an answer like it at the topics but did not found yet.

There are two issues by the way:

Issue #1
As the files are "Newspaper (Day.Month.Year)", how may I change (only) the year from 17 to 2017, or 19 to 2019, or 20 to 2020 in the way it would not change/affect the day or month number, as the example bellow:

Newspaper (03.01.03)
Newspaper (20.01.20)
Newspaper (01.03.20)
Newspaper (19.12.19)
Newspaper (02.01.20)

to

Newspaper (03.01.2003)
Newspaper (20.01.2020)
Newspaper (01.03.2020)
Newspaper (19.12.2019)
Newspaper (02.01.2020)

Issue #2
How may I change the date position to the begining in the way it would also completely reverse the sequence (rearrange rule?), from "day-month-year" to "year-month-day", as the following example:

Newspaper 03-01-2003
Newspaper 20-01-2020
Newspaper 01-03-2020
Newspaper 19-12-2019
Newspaper 02-01-2020

2003-01-03 Newspaper
2020-01-20 Newspaper
2020-03-01 Newspaper
2019-12-19 Newspaper
2020-01-02 Newspaper

Thank you so much in advance!

ps. as today is my birthday I asked for my parents for a ReNamer signature present, good present by the way!! I only have to thank all of you for this so good software, it already helped me so much!

ps2. may a suggest  some improvements in ReNamer software? At the next versions can you add a Dark Mode to the layout soft? I have vision problems and a dark mode would contrast better.

ps3. What is the main ReNamer programming language? MS DOS? Pascal? Python? Java? SQL? A mix on some?

Offline

#4 2020-09-15 17:36

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,046

Re: Change "Badla [2019]" to "2019 - Badla"

Hi Philippe, great it works!

Please let us split this issues to separate threads each to not mix-up them
and to make it easier (other subject line) for others to find the need answer, ok?


- - -

Issue 1
FROM
Newspaper (03.01.03).ext
TO
Newspaper (03.01.2003).ext
TRY RegEx ( http://www.den4b.com/wiki/ReNamer:Rules:RegEx )
Expr: (\d\d\))$
Repl: 20$1

Explanation:
match two digits and an (escaped) closing parenthesis at the end
in a (...)-Subexpression with "name" $1
and replace with what just was matched (stored in $1) plus an leading "20".
((( refer to http://www.den4b.com/wiki/ReNamer:Regular_Expressions )))



- - -

Issue 2

FROM
Newspaper 03-01-2003
TO
Newspaper 2003-01-03
SEE http://www.den4b.com/wiki/ReNamer:Rules:ReformatDate



Issue 3

FROM
Newspaper 2003-01-03
TO
2003-01-03 Newspaper
TRY RegEx ( http://www.den4b.com/wiki/ReNamer:Rules:RegEx )
Expr: ^(.+)(\d{4}-\d\d-\d\d)$
Repl: $2 $1





Issue 2+3 in one step

FROM
Newspaper 03-01-2003
TO
2003-01-03 Newspaper
TRY RegEx ( http://www.den4b.com/wiki/ReNamer:Rules:RegEx )
Expr: ^(.+)(\d\d)-(\d\d)-(\d{4})$
INFO:---$1----$2-----$3-----$4
Repl: $4-$3-$2 $1


See http://www.den4b.com/wiki/ReNamer:Regular_Expressions



 


Please see HELP and MANUAL in Wiki for more info.
If ReNamer had helped you, please donate a coin to Denis or buy a Pro license for commercial use. (Lite vs Pro)

Offline

Board footer

Powered by FluxBB