Page 21 of 109

Can't install RegExp F&R w/o scripts. MM3.1 problem?

Posted: Thu Jun 18, 2009 4:47 am
by RabanePaco
When I try to install RegExp F&R without the 101 sample presets I get the error message

Error #-2147419113 - SongsDB.SDBStringlist
List index out of bounds (0)
File ....\MM\scripts\Auto\RegExpReplace.vbs

There is not the RegExp menu item under Edit.

Installing with the presets seems to be o.k. (so I'll try them anyway :) )

I just updated to MM 3.1. I'm also using MagigNodes. I didn't use RegExp before (didn't know about it).

It seems a very intersting script. I have been using Mp3Tag extensively.

Re: Can't install RegExp F&R w/o scripts. MM3.1 problem?

Posted: Thu Jun 18, 2009 7:37 am
by ZvezdanD
RabanePaco wrote:When I try to install RegExp F&R without the 101 sample presets I get the error message
Thanks for the report. There is a new release: v3.5.1 - 2009-06-18
- Fixed: error during start-up if none preset exists.

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-06-18)[MM2+3]

Posted: Fri Jun 26, 2009 10:11 pm
by stutes
Just wondering if it is possible to append one field with another field. I would like to take the information in fields such as "Mood" and "Tempo" and append the data in the field to the Grouping field, ideally putting a comma and then a space before the data is added to the Grouping field.

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-06-18)[MM2+3]

Posted: Sat Jun 27, 2009 5:01 pm
by ZvezdanD
stutes wrote:Just wondering if it is possible to append one field with another field. I would like to take the information in fields such as "Mood" and "Tempo" and append the data in the field to the Grouping field, ideally putting a comma and then a space before the data is added to the Grouping field.
Of course this is possible, you already have several predefined presets which combines two or more fields into one field, e.g. "Add the Track number to the begin of the Title". Here are settings for your example:
Find what:

Code: Select all

^.*
Into: Grouping
Regular expression 1: checked
Replace with:

Code: Select all

"$&" & IIf(Len(oSongData.Mood) > 0 And Len("$&") > 0, ", ", "") & oSongData.Mood & IIf(Len(oSongData.Tempo) > 0 And Len("$&" & oSongData.Mood) > 0, ", ", "") & oSongData.Tempo
VBScript expression: checked

The Replace with expression could be much simpler if you remove checking for empty fields, i.e. if you have all fields entered.

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-06-18)[MM2+3]

Posted: Sat Jun 27, 2009 11:08 pm
by stutes
ZvezdanD, thank you for the reply. I figured RegExp could do this, but I couldn't figure out how to make it work with the fields I wanted to work with. I've no knowledge of VBscript.

I don''t think I need it to check for empty fields, and I didn't realize I could get it to append BOTH the Mood AND Tempo fields AT ONCE into the Grouping field—that's pretty cool! I was assuming I'd have to run it once to append the Mood to Grouping and then again to append the Tempo to Grouping.

I was also hoping to do the same thing with Custom 2 and Custom 3 (again, no need to check for empty fields as far I as I can tell... unless empty fields cause problems), and append the data in those fields to the Grouping field.

Would I be correct in assuming that the code for Custom 2 and 3 would look something like this?:

Code: Select all

    "$&" & IIf(Len(oSongData.Custom2) > 0 And Len("$&") > 0, ", ", "") & oSongData.Custom2 & IIf(Len(oSongData.Custom3) > 0 And Len("$&" & oSongData.Custom2) > 0, ", ", "") & oSongData.Custom3

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-06-18)[MM2+3]

Posted: Sun Jun 28, 2009 2:05 am
by ZvezdanD
stutes wrote:Would I be correct in assuming that the code for Custom 2 and 3 would look something like this?:

Code: Select all

    "$&" & IIf(Len(oSongData.Custom2) > 0 And Len("$&") > 0, ", ", "") & oSongData.Custom2 & IIf(Len(oSongData.Custom3) > 0 And Len("$&" & oSongData.Custom2) > 0, ", ", "") & oSongData.Custom3
Yes, your Replace with string is correct. However, if you don't want to check for empty fields, you could write previous two presets as one, i.e. you could append Mood, Tempo, Custom 2 and Custom 3 in one go:

Code: Select all

"$&, " & oSongData.Mood & ", " & oSongData.Tempo & ", " & oSongData.Custom2 & ", " & oSongData.Custom3
But, if you have some field empty, e.g. Tempo, with such string you would get something like Grouping, Mood, , Custom2, Custom3. Or, if you have empty Grouping, you would get , Mood, Tempo, Custom1, Custom3 (note a comma on the begin). I don't know your intention, maybe this is even preferable for you.

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-06-18)[MM2+3]

Posted: Mon Jun 29, 2009 10:12 am
by stutes
All at once: very cool! Thanks so much for your help; for someone like me who is vbscript illiterate, this is VERY helpful!

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-06-18)[MM2+3]

Posted: Mon Jun 29, 2009 2:40 pm
by mk1065
Anyone know how I could put all my featured artists in paranthesis. For example:

Find what - ft. Easy E
Replace with - (ft. Easy E)

RegSub Help

Posted: Mon Jun 29, 2009 2:52 pm
by CarlitoGil

Code: Select all

RegSub(RegSub(RegSub(RegSub(RegSub(oSongData.Path,"\bI\b","1"),"\bII\b","2"),"\bIII\b","3"),"\bIV\b","4"),"\bV\b","5")
Is there a more efficient way to do this?
I may be using more substitutions

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-06-18)[MM2+3]

Posted: Mon Jun 29, 2009 3:53 pm
by ZvezdanD
mk1065 wrote:Anyone know how I could put all my featured artists in paranthesis. For example:

Find what - ft. Easy E
Replace with - (ft. Easy E)
Find what:

Code: Select all

\b(?:ft\.?|feat\.?|featuring|vs\.?|versus|pres\.?|presents)\s.*[^)]$
Into: Artist
Regular expression 1: checked
Replace with:

Code: Select all

($&)

Re: RegSub Help

Posted: Mon Jun 29, 2009 4:48 pm
by ZvezdanD
GIL wrote:

Code: Select all

RegSub(RegSub(RegSub(RegSub(RegSub(oSongData.Path,"\bI\b","1"),"\bII\b","2"),"\bIII\b","3"),"\bIV\b","4"),"\bV\b","5")
Is there a more efficient way to do this?
I may be using more substitutions
Well, you could not simplify it too much. You could try with the MapArray function as it is in the "Fix common words (I'm, I'll, don't, won't, ain't, isn't, can't)" preset. For your example:
Find what:

Code: Select all

\b(?:(I)|(II)|(III)|(IV)|(V))\b
Replace with:

Code: Select all

MapArray(Array("$1", "1", "$2", "2", "$3", "3", "$4", "4", "$5", "5"))
However, there is a bug in the MapChr function, so you need to modify the source code of the script if you want to write numbers as a replacement. In the line 987 instead of:

Code: Select all

If IsNumeric(sDst) Then
you should write:

Code: Select all

If VarType(sDst) = vbInteger Then
The next version of the script would have somewhat simpler MapArrayEx function with which you could write the Replace with string directly, without specifying strings for replacement in the Find what field as it is in previous case. Here is its future use:

Code: Select all

MapArrayEx("$&", Array("\bI\b", "1", "\bII\b", "2", "\bIII\b", "3", "\bIV\b", "4", "\bV\b", "5"))
If you are interested for such syntax, I could publish the updated script with that function. By the way, you will have a problem with English word "I" with those replacements.

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-06-18)[MM2+3]

Posted: Tue Jun 30, 2009 2:27 am
by Big Isch
Suggestion for Grouping of Presets

This is really a great tool with lots of capability and lost of presets. Such, some sort of grouping for
presets comes to mind, as already discussed in this topic.

My suggestion is to add a text-field that functions as filter for the presets display in the listbox.
When this field is not-blank, then only Presets starting with the entered text are displayed.
The presets that are delivered with installation could begin with a special letter, e.g. "+" or "!"

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-06-18)[MM2+3]

Posted: Tue Jun 30, 2009 8:30 am
by nynaevelan
Big Isch wrote:Suggestion for Grouping of Presets

This is really a great tool with lots of capability and lost of presets. Such, some sort of grouping for
presets comes to mind, as already discussed in this topic.

My suggestion is to add a text-field that functions as filter for the presets display in the listbox.
When this field is not-blank, then only Presets starting with the entered text are displayed.
The presets that are delivered with installation could begin with a special letter, e.g. "+" or "!"
As an organizational maniac I agree with this suggestion. :D

Nyn

Re: RegExp Find & Replace 3.5 w/ 101 presets (2009-06-18)[MM2+3]

Posted: Tue Jun 30, 2009 11:51 am
by martialartsguy
Question here, and again I apologize for my lack of knowledge with regexp. I'd like to capitalize all the text (from: happy to: Happy) in all the following fields:

Tempo, Mood, Occasion, Quality

I use these a lot and sometimes forget to capitalize. I have presets set up for each one, but if I could run all four at once, that'd be excellent.
Each has the following setting:

Find What: ([\w\xDF-\xF6\xF8-\xFF\u0100-\u024F\u0400-\u04FF])([\w'\xDF-\xF6\xF8-\xFF\u0100-\u024F\u0400-\u04FF]*)
Replace with: UCase("$1") & LCase("$2")

Thanks for your help.

Re: RegSub Help

Posted: Tue Jun 30, 2009 2:07 pm
by CarlitoGil
The next version of the script would have somewhat simpler MapArrayEx function with which you could write the Replace with string directly, without specifying strings for replacement in the Find what field as it is in previous case. Here is its future use:

Code: Select all

MapArrayEx("$&", Array("\bI\b", "1", "\bII\b", "2", "\bIII\b", "3", "\bIV\b", "4", "\bV\b", "5"))
Thanks, That's what I need to modify from another fields than the one with the numbers
If you are interested for such syntax, I could publish the updated script with that function.
Yeah
Do you ever wish you could get the version 35.9 of this script from the year 2025?
By the way, you will have a problem with English word "I" with those replacements.
That's no problem, I'll be using this to detect Disc # from the path, so it would need to say "I" after the words (CD|Disc|Disk|Disco), you know.