Please take a minute to check our Frequently Asked Questions. Use Search to reveal possible related topics.
Also make sure you've read the Forum Guidelines before posting in this forum.
![]() ![]() |
Mar 20 2011, 01:38
Post
#31
|
|
|
Member Group: Full Members Posts: 64 Joined: 8-November 10 From: UK Member No.: 13190 Mp3tag Version: 2.48 |
Good work, Doug. That script is taking shape quite nicely. Actually, I'm in the process of putting together my own one, which I intend to post here when finished. I'd like to incorporate some bits of your script into it too - with your permission, of course. There's just one obstacle that remains: Roman numerals. I've made a new thread in the support forum to address this. Perhaps when you have the time you could take a look at it? Thanks.
|
|
|
|
Mar 20 2011, 18:02
Post
#32
|
|
|
Member Group: Full Members Posts: 35 Joined: 27-April 09 From: New Jersey, USA Member No.: 9952 Mp3tag Version: 2.51 |
... I'm in the process of putting together my own, which I intend to post here when finished. I'd like to incorporate some bits of your script into it too - with your permission, of course. Yes, certainly. As far as I am concerned, this is a group project. As for Roman numerals, it looks like DetlevD has a better solution than I could come up with. I simply included the two-letter values below ten in my abbreviation list, which was adequate for my purposes. |
|
|
|
Mar 20 2011, 19:45
Post
#33
|
|
![]() Moderator Group: Moderators Posts: 5506 Joined: 4-September 03 From: Germany Member No.: 201 Mp3tag Version: 2.55a |
([-({ _.+\u201c"])(\l) is not correct in Mp3tag.
This should be the right syntax: ([-({ _.+\x{201c}"])(\l) -------------------- |
|
|
|
Mar 20 2011, 23:37
Post
#34
|
|
|
Member Group: Full Members Posts: 35 Joined: 27-April 09 From: New Jersey, USA Member No.: 9952 Mp3tag Version: 2.51 |
... This should be the right syntax: ([-({ _.+\x{201c}"])(\l) Dano, thank you for spotting my error. What confused me was that the \u201c syntax appeared in MTA files (which is how I discovered it), and the fact that it worked as expected. The first time that I typed “ into a regular expression field, it appeared as \u201c in the MTA file. Since I was having trouble seeing this character in the tiny font used in Mp3tag input boxes, I thought that a Unicode reference would be clearer. It seems that in MTA files, Mp3Tag uses double backslashes (\\u) to distinguish an uppercase character reference from an internal \u-style Unicode reference. Even more confusing is that in languages like .Net that support regular expressions, \x is used for hex values and \u for Unicode numbers! Anyway, I have edited my posted MTA files and changed my example above to the correct syntax. Regards, Doug Mackie |
|
|
|
Mar 21 2011, 08:58
Post
#35
|
|
![]() Member Group: Full Members Posts: 4129 Joined: 26-May 06 From: Wuppertal, Germany, Planet Earth Member No.: 3194 Mp3tag Version: 2.54 |
... What confused me was that the \u201c syntax appeared in MTA files (which is how I discovered it) ... The MTA file look like a sort of INI style pure text file, where special characters need 'escaping'. See also: http://en.wikipedia.org/wiki/INI_file Well, the Mp3tag developer might answer how he does things to make Mp3tag run, but as MTA files are not documented to view internally by the user or change manually by the user, the answer is already given: Hands off! DD.20110321.0858.CET -------------------- * Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥ |
|
|
|
Mar 23 2011, 17:07
Post
#36
|
|
|
Member Group: Full Members Posts: 64 Joined: 8-November 10 From: UK Member No.: 13190 Mp3tag Version: 2.48 |
Update: The script is now complete, except for a couple of minor bugs which I'd like to get fixed before release. Once again, I'm relying on you guys to help me out here, as I'm completely stuck.
The first bug relates to formatting spaces between acronyms. In the case of acronyms without a stop at the end (i.e. "M.I.A"), the script places a space between the last stop and the last character. Hence, "M.I.A" becomes "M.I. A". Notice the space before "A". Obviously, I want to prevent the extra space from occurring. I looked closely at the script and noticed that in the "replace matches with" field, there was a trailing space at the end of $0. I then removed the space and repeated the action. This time the acronym "M.I.A" was not split by an extra space. My concern then, is was the space after $0 intentional or is it a mistake? Can I safely remove the space without making the action invalid? Here's the relevant action: Description: Word Spacing Action type: Replace with regular expression Field: _All Regular expression: (\.)(?![\s\.':;\)\]"])(?![\l\u]\.)(?!$)(?!\d)(?!(co|net|org|gov|edu|mil)) Replace matches with: $0 (ed: there is a space after 0) [ ] case-sensitive comparison The second bug concerns case conversion of "Dj". If Dj is the first word after a parenthesis, a space is placed between the parenthesis and D. Hence, "(Dj Remix)" becomes "( DJ Remix). I'd like to prevent the redundant space from occurring. As in the first bug, there is a space in the "replace matches with" field that if removed stops the error. This time it's at the beginning of the line: " DJ$1". Again, I'm not sure if it is a mistake or intentional. If I remove it, will it invalidate the script? Edit: The space actually occurs anywhere in the line, not only after parenthesis. Description: Uper-Case conversion of Dj Action type: Replace with regular expression Field: _All Regular expression: dj($|\s) Replace matches with: DJ$1 (ed: the first character is a space) [ ] case-sensitive comparison Thanks again for your assistance, guys. This post has been edited by yog-sothoth: Mar 23 2011, 17:21 |
|
|
|
Mar 23 2011, 20:44
Post
#37
|
|
![]() Moderator Group: Moderators Posts: 5506 Joined: 4-September 03 From: Germany Member No.: 201 Mp3tag Version: 2.55a |
A change in the first action can solve the problem:
Regular expression: (\.)(?![\s\.':;\)\]"])(?)(?!$)(?!\d)(?!(co|net|org|gov|edu|mil)) The space in the second action is much likely a bug. -------------------- |
|
|
|
Mar 23 2011, 21:58
Post
#38
|
|
|
Member Group: Full Members Posts: 64 Joined: 8-November 10 From: UK Member No.: 13190 Mp3tag Version: 2.48 |
A change in the first action can solve the problem: Regular expression: (\.)(?![\s\.':;\)\]"])(?)(?!$)(?!\d)(?!(co|net|org|gov|edu|mil)) This only works if there are no words after the acronym. For instance, "M.I.A featuring..." converts to "M.I. a Featuring...". Also, a space is now placed between the extension in the filename and the stop before it, a la ". mp3". This makes the file inaccessible until the space is removed. I'm wondering what exactly this action tries to fix, and if I should remove it all together. The action above is part of a group of eleven actions, all of which concern spacing. From the end of the reg ex, I can deduce that it does something to URL's. I'm not entirely sure what the rest does, though. If you can figure it out, could you explain it to me? Thanks. BTW, this is the source. This post has been edited by yog-sothoth: Mar 23 2011, 22:06 |
|
|
|
Mar 23 2011, 22:39
Post
#39
|
|
![]() Moderator Group: Moderators Posts: 5506 Joined: 4-September 03 From: Germany Member No.: 201 Mp3tag Version: 2.55a |
Read the description:
1. Add a space after a period. [...] And it does nothing to urls. It excludes them so for example ".net" is not changed to ". net" You could also add the space: RE: (\.)(?![\s\.':;\)\]"])(?)(?!$)(?!\d)(?!(co|net|org|gov|edu|mil)) If you want to use this on the filename use the $regexp() function. -------------------- |
|
|
|
Mar 23 2011, 23:09
Post
#40
|
|
|
Member Group: Full Members Posts: 64 Joined: 8-November 10 From: UK Member No.: 13190 Mp3tag Version: 2.48 |
Thanks, that works. Much appreciated.
|
|
|
|
Mar 28 2011, 14:16
Post
#41
|
|
|
Member Group: Full Members Posts: 64 Joined: 8-November 10 From: UK Member No.: 13190 Mp3tag Version: 2.48 |
|
|
|
|
Mar 28 2011, 14:31
Post
#42
|
|
![]() Moderator Group: Moderators Posts: 5506 Joined: 4-September 03 From: Germany Member No.: 201 Mp3tag Version: 2.55a |
Hi dano, I can't seem to figure the correct syntax out. Could you show me the way, please? $regexp(%_filename%,'(\.)(?![\s\.'''':;\)\]"])(?)(?!$)(?!\d)(?!(co|net|org|gov|edu|mil))',$0 ) -------------------- |
|
|
|
Mar 28 2011, 14:51
Post
#43
|
|
|
Member Group: Full Members Posts: 64 Joined: 8-November 10 From: UK Member No.: 13190 Mp3tag Version: 2.48 |
Thanks dano.
|
|
|
|
Mar 28 2011, 18:05
Post
#44
|
|
|
Member Group: Full Members Posts: 64 Joined: 8-November 10 From: UK Member No.: 13190 Mp3tag Version: 2.48 |
I've just created my first regex script from scratch. It's very basic, but it seems to do its job ok. I just want some advice on whether or not there is a better method.
The purpose of the script is to remove white space between initials and an ampersand (&). For instance, "R & B" to "R&B". Action type: Replace with regular expression Field: _TAG Regular expression: \b([a-zA-Z])\s(&)\s([a-zA-Z])\b Replace matches with: $1$2$3 [ ] case-sensitive comparison Did I do alright? This post has been edited by yog-sothoth: Mar 28 2011, 18:12 |
|
|
|
Mar 28 2011, 19:11
Post
#45
|
||
![]() Member Group: Full Members Posts: 4129 Joined: 26-May 06 From: Wuppertal, Germany, Planet Earth Member No.: 3194 Mp3tag Version: 2.54 |
I've just created my first regex script from scratch. It's very basic, but it seems to do its job ok. I just want some advice on whether or not there is a better method. The purpose of the script is to remove white space between initials and an ampersand (&). For instance, "R & B" to "R&B". ... It looks like a working regular expression. Congratulations! If you want such matches, then it would be the right regular expression for you. Note: If you do not check the 'case-sensitive comparison', then it makes no sense to build a character group of '[a-zA-Z]'. Be aware that all tag-fields will be respected when using the pseudo tag-field '_TAG'. You can also think about how to avoid false positives. A simple $replace could be more safe. DD.20110328.2012.CEST -------------------- * Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥ |
|
|
|
||
![]() ![]() |
|
Lo-Fi Version | Time is now: 22nd May 2013 - 10:21 |