Alternate form of underscore?

Community forum for discussions completely unrelated to MediaMonkey.

Moderator: Gurus

MMFrLife
Posts: 2894
Joined: Fri Oct 26, 2012 9:04 pm
Location: MM Forum

Alternate form of underscore?

Post by MMFrLife »

Does anyone know of a way to make an underscore that's like a hyphen (lengthwise) but in the underscore position?
Maybe a special character. I've never seen one, though.

Using a period instead will not work for what I need.

Thanks
MM user since 2003 (lifetime lic. 2012) "Trying to imagine life without music gives me a headache"
Top 2 scripts: RegExp Find & Replace (e.v.) and Magic Nodes (e.v.) ZvezdanD's scripts site
Please take a moment to read the bottom of the linked page to support the one and only - ZvezdanD! (the "originator" since 2006).
MMW 4.1.31.1919; 5.0.4.2690 || back it up...frequently!
|| software for power users: "Q-Dir" (free alt. to explorer) and file/folder renamer: "ReNamer" (den4b)
"The absurd is the essential concept and the first truth"
😜
dtsig
Posts: 3588
Joined: Mon Jan 24, 2011 6:34 pm

Re: Alternate form of underscore?

Post by dtsig »

I haven't tried it for a long time but ... if you look at a table for ascii ... look at the higher range of chars. they can be created by holding ALTand entering number on keypad
Where's the db and ini stored
Reporting Bugs
Where tags are stored

Not affiliated with MediaMonkey ... just a RABID user/lover
DTSig
MMFrLife
Posts: 2894
Joined: Fri Oct 26, 2012 9:04 pm
Location: MM Forum

Re: Alternate form of underscore?

Post by MMFrLife »

Nice try!
Unfortunately, it provides the same length.

Looks like I'll have to bother ZD later on about a way around what I'm trying to do.

Thanks a mil. 8)
MM user since 2003 (lifetime lic. 2012) "Trying to imagine life without music gives me a headache"
Top 2 scripts: RegExp Find & Replace (e.v.) and Magic Nodes (e.v.) ZvezdanD's scripts site
Please take a moment to read the bottom of the linked page to support the one and only - ZvezdanD! (the "originator" since 2006).
MMW 4.1.31.1919; 5.0.4.2690 || back it up...frequently!
|| software for power users: "Q-Dir" (free alt. to explorer) and file/folder renamer: "ReNamer" (den4b)
"The absurd is the essential concept and the first truth"
😜
rivorson
Posts: 594
Joined: Thu Jul 25, 2013 4:17 am

Re: Alternate form of underscore?

Post by rivorson »

I don't think such a character exists. There's a longer hyphen but not a lower hyphen.

What are you trying to achieve?
MMFrLife
Posts: 2894
Joined: Fri Oct 26, 2012 9:04 pm
Location: MM Forum

Re: Alternate form of underscore?

Post by MMFrLife »

According to wikipedia for "Underscore", such a thing does not exist.

1. There is a hypen and a minus (same thing, shortest length)
2. There are 4 dashes of varying lengths, the shortest of which is longer than a hyphen/minus (about the length of 2 hypens)
3. And a single underscore. The length is the shortest of the dashes but in the bottom position.

To make a long story short, its purpose is as a leading separator for Folder tag ID info. It needs to be a character that doesn't
get ignored and cause the second character (first letter) to be capitalized using "capitalize with exceptions" when running RFR add-on.
Periods and no space hyphens are ignored and IDs like "ep", ".lv", "-xb" get the first letters capitalized as such "-Xb".

The underscore does not get ignored (but goes unchanged), leaving what it detects as the second letter (actually the first) in lowercase.
That is a good thing. However, when used as a lead off next to an album or title, it's just a bit ugly/awkward looking. "Back in Black _lv"

Anyway, I think I'll just use that. It's looking better the more I look at it and a couple of spaces in between helps the looks.
It also works better when used in searching. The period is ignored and the hyphen negates the query, as expected
Last edited by MMFrLife on Thu Jan 05, 2017 4:21 pm, edited 2 times in total.
MM user since 2003 (lifetime lic. 2012) "Trying to imagine life without music gives me a headache"
Top 2 scripts: RegExp Find & Replace (e.v.) and Magic Nodes (e.v.) ZvezdanD's scripts site
Please take a moment to read the bottom of the linked page to support the one and only - ZvezdanD! (the "originator" since 2006).
MMW 4.1.31.1919; 5.0.4.2690 || back it up...frequently!
|| software for power users: "Q-Dir" (free alt. to explorer) and file/folder renamer: "ReNamer" (den4b)
"The absurd is the essential concept and the first truth"
😜
rivorson
Posts: 594
Joined: Thu Jul 25, 2013 4:17 am

Re: Alternate form of underscore?

Post by rivorson »

I've had a look at the regex on that preset. It will capitalize the first character in every group of 'word' characters. Regex defines a 'word' character as anything alphanumeric plus the underscore, so the underscore is the only character that will not cause the following letter to be capitalized in that preset by default.

You could add any character you want to the preset. Just add the character you want to use to the regex after the first "\w" (not the one that is immediately followed by an apostraphe). For example if you want to use the hyphen then that part would become "\w-". Some characters have special meaning in regex so to be safe you could escape it using a backslash, e.g. "\w\-".
MMFrLife
Posts: 2894
Joined: Fri Oct 26, 2012 9:04 pm
Location: MM Forum

Re: Alternate form of underscore?

Post by MMFrLife »

I'm using "....with exceptions" preset, as mentioned.
Only the regular "Capitalize" preset has a "\w" close to an apostrophe, and one later.
MM user since 2003 (lifetime lic. 2012) "Trying to imagine life without music gives me a headache"
Top 2 scripts: RegExp Find & Replace (e.v.) and Magic Nodes (e.v.) ZvezdanD's scripts site
Please take a moment to read the bottom of the linked page to support the one and only - ZvezdanD! (the "originator" since 2006).
MMW 4.1.31.1919; 5.0.4.2690 || back it up...frequently!
|| software for power users: "Q-Dir" (free alt. to explorer) and file/folder renamer: "ReNamer" (den4b)
"The absurd is the essential concept and the first truth"
😜
rivorson
Posts: 594
Joined: Thu Jul 25, 2013 4:17 am

Re: Alternate form of underscore?

Post by rivorson »

Both Capitalize presets have it. They're actually the same regex but the one with exceptions has some extra code added at the beginning.

This is the Capitalize with exceptions preset modified to not capitalize after a hyphen:

Code: Select all

(\s(?:as?|and?|'n'|at|by|del?|des|du|el|feat\.?|for|from|in|into|las?|les?|los|of|on|or|pres\.|the|to|vs\.?)(?=\s))|(\b(?:III?|PM|SOS|UK|USA))\b|([\w-\xDF-\xF6\xF8-\xFF\u0100-\u024F\u0400-\u04FF])([\w'\xDF-\xF6\xF8-\xFF\u0100-\u024F\u0400-\u04FF]*)
MMFrLife
Posts: 2894
Joined: Fri Oct 26, 2012 9:04 pm
Location: MM Forum

Re: Alternate form of underscore?

Post by MMFrLife »

Right, right. I was focusing too hard on the first section.

So, if I want to add more than one, this appears to be ok

Code: Select all

\w-\w.\
, but If I want to add multiple with escape,

Code: Select all

\w\-\w\.\
?
MM user since 2003 (lifetime lic. 2012) "Trying to imagine life without music gives me a headache"
Top 2 scripts: RegExp Find & Replace (e.v.) and Magic Nodes (e.v.) ZvezdanD's scripts site
Please take a moment to read the bottom of the linked page to support the one and only - ZvezdanD! (the "originator" since 2006).
MMW 4.1.31.1919; 5.0.4.2690 || back it up...frequently!
|| software for power users: "Q-Dir" (free alt. to explorer) and file/folder renamer: "ReNamer" (den4b)
"The absurd is the essential concept and the first truth"
😜
rivorson
Posts: 594
Joined: Thu Jul 25, 2013 4:17 am

Re: Alternate form of underscore?

Post by rivorson »

The escaped version would work but you don't need to add the extra \w. The dot is interpreted to mean any character in regex so it needs escaping.

The full regex for both hyphen and the dot would be:

Code: Select all

(\s(?:as?|and?|'n'|at|by|del?|des|du|el|feat\.?|for|from|in|into|las?|les?|los|of|on|or|pres\.|the|to|vs\.?)(?=\s))|(\b(?:III?|PM|SOS|UK|USA))\b|([\w-\.\xDF-\xF6\xF8-\xFF\u0100-\u024F\u0400-\u04FF])([\w'\xDF-\xF6\xF8-\xFF\u0100-\u024F\u0400-\u04FF]*)
MMFrLife
Posts: 2894
Joined: Fri Oct 26, 2012 9:04 pm
Location: MM Forum

Re: Alternate form of underscore?

Post by MMFrLife »

Ok. Thanks!
I will play around with it.
MM user since 2003 (lifetime lic. 2012) "Trying to imagine life without music gives me a headache"
Top 2 scripts: RegExp Find & Replace (e.v.) and Magic Nodes (e.v.) ZvezdanD's scripts site
Please take a moment to read the bottom of the linked page to support the one and only - ZvezdanD! (the "originator" since 2006).
MMW 4.1.31.1919; 5.0.4.2690 || back it up...frequently!
|| software for power users: "Q-Dir" (free alt. to explorer) and file/folder renamer: "ReNamer" (den4b)
"The absurd is the essential concept and the first truth"
😜
MMFrLife
Posts: 2894
Joined: Fri Oct 26, 2012 9:04 pm
Location: MM Forum

Re: Alternate form of underscore?

Post by MMFrLife »

So, I could really just do the one "\w" and add any characters after, taking care of both the escape and no escape situations?

like

Code: Select all

\w\-\.\[\
It appears to work when tested.
MM user since 2003 (lifetime lic. 2012) "Trying to imagine life without music gives me a headache"
Top 2 scripts: RegExp Find & Replace (e.v.) and Magic Nodes (e.v.) ZvezdanD's scripts site
Please take a moment to read the bottom of the linked page to support the one and only - ZvezdanD! (the "originator" since 2006).
MMW 4.1.31.1919; 5.0.4.2690 || back it up...frequently!
|| software for power users: "Q-Dir" (free alt. to explorer) and file/folder renamer: "ReNamer" (den4b)
"The absurd is the essential concept and the first truth"
😜
rivorson
Posts: 594
Joined: Thu Jul 25, 2013 4:17 am

Re: Alternate form of underscore?

Post by rivorson »

Seems like you have it perfectly.

http://regexr.com/ has a good reference and cheat sheet if you want to learn more. That's where I learned about it, but it is complicated and it took me several attempts just to get started.
MMFrLife
Posts: 2894
Joined: Fri Oct 26, 2012 9:04 pm
Location: MM Forum

Re: Alternate form of underscore?

Post by MMFrLife »

Yeah, ZD taught me a little bit a while back, including escape concept, but I haven't really practiced or looked into things since.
I didn't know about the word character element "\w". That really opens things up. ZD pointed me to a site or two, but I've never seen
that one. It looks really great for learning, interacting. I'll definitely need to explore that. If I have any questions, I'll post to Off Topic under
something like "Regular Expressions". Be on the lookout if you're interested.

Thanks in bunches! :D
MM user since 2003 (lifetime lic. 2012) "Trying to imagine life without music gives me a headache"
Top 2 scripts: RegExp Find & Replace (e.v.) and Magic Nodes (e.v.) ZvezdanD's scripts site
Please take a moment to read the bottom of the linked page to support the one and only - ZvezdanD! (the "originator" since 2006).
MMW 4.1.31.1919; 5.0.4.2690 || back it up...frequently!
|| software for power users: "Q-Dir" (free alt. to explorer) and file/folder renamer: "ReNamer" (den4b)
"The absurd is the essential concept and the first truth"
😜
Post Reply