Page 107 of 108

Regex and dates

Posted: Sun Jan 16, 2022 11:27 pm
by Oztours
These days using MM5 but gone back to MM4 to complete a project with "Regexp Find & Replace". I have a bunch of about 1,000 Old Time Radio serials that have been named as follows in the title:
mm/dd/yy - Episode ### - Episode Name

I would like to swap the date part of it to be "yy/mm/dd" but no amount of searching or trial and error has given me a solution. Mind you, I'm not a programmer, just a tinkerer and get easily confused with some of the presets. Most likely staring me in the face, but be damned if I can see it.

Any assistance appreciated.

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

Posted: Thu Jan 20, 2022 4:56 am
by ZvezdanD
Oztours wrote: Sun Jan 16, 2022 11:27 pm mm/dd/yy - Episode ### - Episode Name

I would like to swap the date part of it to be "yy/mm/dd"
Find what: ^(\d\d/\d\d)(?:/(\d\d))
Replace with: $2/$1

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

Posted: Thu Jan 20, 2022 7:14 am
by Oztours
@ZvezdanD

Many thanks for that answer. My dilemma was solved and fully utilized within minutes of my reading your post.

In appreciation, I sent a donation to help with your possible porting to MM5. I for one look forward to that becoming a reality.

Cheers

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

Posted: Sun Feb 27, 2022 9:30 am
by kluv
Hi and I hope you all are doing well.
What preset would be best to use or edit in order to keep the key but remove the dash and everything after it like:
9A - www,viperial,com
9A - PMEDIA
9A - bf570f03-5287-45f5-aaa2-21ba6a4d585f

but I need to also keep two key tags like:
9B/9A

Thank you,

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

Posted: Sun Feb 27, 2022 4:17 pm
by Peke
Hi,
Bit off topic, but:
FYI MM5 support Initial Key natively, so when I do DJ set and want to have wide diversity of Track keys so that I can easily do Harmonic mixing I use "<Initial Key>\<BPM> -!- <Title> - <Artist>" As sync Mask for Tracks And my GIG USB drive so I can easily locate them no matter what I use at gig.

On Topic:
If Format is correct The best would be to Trim space on read Initial Key and store it in one of Custom Tags that can be eaasily used in MM4 also.

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

Posted: Sat Mar 05, 2022 3:09 am
by MMFrLife
kluv wrote: Sun Feb 27, 2022 9:30 am What preset would be best to use or edit in order to keep the key but remove the dash and everything after it like:
9A - www,viperial,com
9A - PMEDIA
9A - bf570f03-5287-45f5-aaa2-21ba6a4d585f
In the enhanced version, there are multiple "Keep..." presets spread across multiple menu classes

Maybe these from the 'Word Manipulations' menu will help for those particular examples:
Keep only specified number of words on the start of <Into Field>...
Keep only specified number of words on the end of <Into Field>...
Keep only specified number of words after left-specified position in <Into Field>...
Keep only specified number of words before right-specified position in <Into Field>...


I'm guessing the first one.
kluv wrote: Sun Feb 27, 2022 9:30 am but I need to also keep two key tags like:
9B/9A
Huh?
Only the '9A' part is in the examples above. Are you talking about another scenario/field?
Examples?

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

Posted: Sat Mar 05, 2022 4:32 am
by ZvezdanD
The "Keep ..." presets from the "Separated field parts" menu are intended exactly for that, with the dash specified as separator. Although, these presets are just a special case of the presets from the "Partial manipulations" menu, which could be used for the same purpose as well but will a little bit more settings.

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

Posted: Sat Apr 30, 2022 12:15 pm
by kluv
Hi!
I'm trying to delete a particular word from my music tags but when I use the "All Text Fields" option, it doesn't search all text fields.

I did: Find What: PMEDIA, Into: All Text Fields, Replace with: Blank

In the example below I numbered all the empty fields in the MM tag 1-13:

Up All Night;Khalid;Hot R&B.Hip-Hop Songs 2019.11.30;Billboard;Pop; R&B; Soul; Alternative; American; Electronic;1;2;4;6;;;;;E:\_MUSIC\_MM Music Directory\Billboard\Hot R&B.Hip-Hop Songs 2019.11.30\89 - Khalid - Up All Night.mp3;7;8;5;Energy 6;4B;;;;;

The fields that aren't searched are:
3- Original date
9- Original lyricist
10- ISRC
11- Publisher
12- Encoder
13- Copyright
How do I get these missing fields to be searched and the word (PMEDIA) replaced?
Thank you!

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

Posted: Sat Apr 30, 2022 12:33 pm
by ZvezdanD
Here is the excerpt from the Usage section:
"the first item in the Into list (All Text Fields) is specific and it allows modification of several textual fields at once using the same replacement. You could specify which text fields you want to modify using settings in the Search sheet of the Options dialog box"

If you find that the All Text Fields option is not working with the fields that are checked on the mentioned setting , that would be a bug. By the way, be very careful not to have checked on Path with that option.

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

Posted: Sat Apr 30, 2022 4:50 pm
by kluv
ZvezdanD wrote: Sat Apr 30, 2022 12:33 pm Here is the excerpt from the Usage section:
"the first item in the Into list (All Text Fields) is specific and it allows modification of several textual fields at once using the same replacement. You could specify which text fields you want to modify using settings in the Search sheet of the Options dialog box"
What preset are you referring to? I thought this would be simple so I made up my own preset but if there's already one I'd like to use that.

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

Posted: Sat Apr 30, 2022 5:42 pm
by ZvezdanD
I didn't refer any preset. You reported that the mentioned option "doesn't search all text fields" and I just quoted the part of the Usage section from the web page of the add-on that explains how to specify which fields would be included for the replacement.

You should check out the mentioned Search page in the Options dialog box to verify if the "fields that aren't searched" are selected or not.

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

Posted: Sat Apr 30, 2022 7:18 pm
by kluv
Search page in the Options dialog box
Is the Search page where all the presets are at? If not I'm not sure how to get to it.

I don't see anything referred to as a Search page and all I see for Options doesn't deal with preset modifications.

Could you walk me through it please.

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

Posted: Sat Apr 30, 2022 7:44 pm
by MMFrLife
@Kluv

MM's
Tools > Options > Library > Search

That determines the execution of 'All Text Fields' in the addon.

...but you should not set/or be highly cautious of setting the path field here for use
with 'All Text Fields" (might cause serious problems), rather you could use the
replace preset for path separately.

Regexp 4.3 - preset #207 not working for me

Posted: Mon May 02, 2022 4:05 pm
by Asheville
Until there is a version of Regexp for MM5, I am using it with MM4. Preset #207 is the only one that I found that will capture the name of the last folder. It isn't working for me.

I tried to understand the 'expression' language so I could figure out what went wrong, but I don't get it.

Can anyone tell me perhaps what I need to change?

RegExp(RegExpEx(oSongData.Path, "\\([^\\]+)\\([^\\]+)\.([^\.\\]+)$", 0, 0), "^([^-]*)(?=\s-\s.*)", 0)

TY,
Michael

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

Posted: Mon May 02, 2022 6:57 pm
by Asheville
Yes, I am replying to myself.

I don't understand this language, but nonetheless, I went to a webpage that showed a script for capturing the last folder of a path. I screwed around with the code and made this work - at least, it's doing what I wanted to do. I wanted to simply capture the name of the last folder so I could place it in a tag.

Here it is: RegExp(oSongData.Path, "[^\\]+(?=\\[^\\]+\\?$)", 0)

I believe that that preset #207 was supposed to extract part of the folder name. That's not what I wanted and that's not what my script does. Select "VBScript expression" in Regexp when you use this.

This is what it does:

C:\Music\Artist\AlbumName\song.mp3 ==> AlbumName may be used for any of many tags.

- Michael