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 2012, 16:18
Post
#1
|
|
|
Member Group: Members Posts: 2 Joined: 20-March 12 Member No.: 16224 Mp3tag Version: 2.50 |
I'm trying to extract an artist from a title and I'm running into issues.
I've tried regexp web testers and the code seems fine. But when I use it in MP3Tag.. I get an errors. example title: I'm Every Woman [Whitney Houston] Format value Field: ARTIST Format string: $regexp(%title%,(.*) \[(.*)\],$2) This is the error I get: REGEXP ERROR: Regular expression Escape sequence terminated prematurely. The error occurred while parsing the regular expression: '(.*) \>>>HERE>>>'. What am I missing? This isn't a complicated expression. I tried double escaping the [ with \\[ but that didn't help. |
|
|
|
Mar 20 2012, 16:47
Post
#2
|
|
![]() Member Group: Full Members Posts: 1571 Joined: 15-March 09 From: Germany Member No.: 9103 Mp3tag Version: 2.50 |
I'm trying to extract an artist from a title and I'm running into issues. I've tried regexp web testers and the code seems fine. But when I use it in MP3Tag.. I get an errors. example title: I'm Every Woman [Whitney Houston] Format value Field: ARTIST Format string: $regexp(%title%,(.*) \[(.*)\],$2) This is the error I get: REGEXP ERROR: Regular expression Escape sequence terminated prematurely. The error occurred while parsing the regular expression: '(.*) \>>>HERE>>>'. What am I missing? This isn't a complicated expression. I tried double escaping the [ with \\[ but that didn't help. You are missing the Mp3tag Scripting Syntax http://help.mp3tag.de/main_scripting.html If you are using one of these characters: []$%,() you have to put them (or the whole expression) in single quotes to escape Mp3tag scripting. $regexp(%title%,'(.*) \[(.*)\]',$2) |
|
|
|
Mar 20 2012, 16:58
Post
#3
|
|
|
Member Group: Members Posts: 2 Joined: 20-March 12 Member No.: 16224 Mp3tag Version: 2.50 |
You are missing the Mp3tag Scripting Syntax http://help.mp3tag.de/main_scripting.html If you are using one of these characters: []$%,() you have to put them (or the whole expression) in single quotes to escape Mp3tag scripting. $regexp(%title%,'(.*) \[(.*)\]',$2) Thanks! I missed that. I was just about to post that I found out that I needed the single quotes. most of the searches in the forum for $regexp didn't use the single quote. I found one that did and said "hmm.." and that's when it started working! And now that I read the full scripting section I see the CODE Characters with special functionality [...] The contents of brackets are displayed only if at least one of the placeholders used inside the brackets has been found. ' Outputs raw text without parsing. This will output the contained string and ignore all reserved characters. If you want to output this character please use ''. []$% You have to put the single quote around these reserved characters if you want to use them unparsed. ,() These characters must only be escaped when they are inside a scripting function. Thanks for the help! Jim |
|
|
|
Mar 21 2012, 16:15
Post
#4
|
|
|
Member Group: Full Members Posts: 88 Joined: 23-September 08 Member No.: 7617 Mp3tag Version: 2.51 |
The single quotation marks might be added in the help regarding replace with regular expressions, http://help.mp3tag.de/options_format.html#regexp. There,
ZITAT All characters except . | * ? + ( ) { } [ ] ^ $. is stated. This confused me a couple of days ago, when I tried to escape a (.These characters are literals when preceded by a "\". I filed a bug report, although this is a minor issue only, http://forums.mp3tag.de/index.php?showtopic=15381. |
|
|
|
Mar 21 2012, 17:33
Post
#5
|
|
![]() Member Group: Full Members Posts: 1571 Joined: 15-March 09 From: Germany Member No.: 9103 Mp3tag Version: 2.50 |
The single quotation marks might be added in the help regarding replace with regular expressions, http://help.mp3tag.de/options_format.html#regexp. There, is stated. This confused me a couple of days ago, when I tried to escape a (. I filed a bug report, although this is a minor issue only, http://forums.mp3tag.de/index.php?showtopic=15381. Your confusion isn't cleared yet. The single qotation mark has not to be added to the characters with special funcitions for regular expressions. It has only a special function at "function scripting" The "problem" is, that Mp3tag has different scripting languages, which can be combined at some places: 1. Function scripting: http://help.mp3tag.de/main_scripting.html Special characters: []$%,() Escape with: ' 2: Web Sources scripting: http://help.mp3tag.de/main_online.html Special characters: "# Escape with: \ 3: Filter scripting: http://help.mp3tag.de/main_filter.html Special characters: " can not be escaped 4: Regulare Expressions scripting: http://help.mp3tag.de/options_format.html#regexp Special characters: . | * ? + ( ) { } [ ] ^ $. Escape with: \ Regular Expressions can be combined with the three other scripting "enviroments". But you only have to care about single quotes or the double function of [] if you combine it with Function scripting. This post has been edited by pone: Mar 26 2012, 16:58 |
|
|
|
Mar 26 2012, 14:55
Post
#6
|
|
|
Member Group: Full Members Posts: 88 Joined: 23-September 08 Member No.: 7617 Mp3tag Version: 2.51 |
Your confusion isn't cleared yet. The single qotation mark has not to be added to the characters with special funcitions for regular expressions. It has only a special function at "function scripting" Okay, thanks for giving me advice! It's hard to understand when consulting single sections of MP3Tag's help (at least for me), but I don't mean to be critical! If I could, I would come up with constructive feedback.The "problem" is, that Mp3tag has different scripting languages, which can be combined at some places: |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 23rd May 2013 - 18:14 |