More > JRiver Media Center 25 for Mac
regex() string manipulation on MAC
MartinG:
Hi.
Any advice is welcome.
Actually I can't get the regex() manipulation work on a MAC, while it works perfectly in a Windows environment. This is what the complete string looks like:
Left(MoveArticles([Album]),1)\regex(replace([Album],:, / /-),/#([^\s,]+)#/,-1,1)[R1]\ replace([Album],:, / /-) - if(isequal([Dirigent], Unbekannt Dirigent),[Albuminterpret], if(isequal([Albuminterpret],if(isequal(Left([Dirigent],3),Sir),removeleft([Dirigent],4),[Dirigent]),1), regex(Swap([Albuminterpret]),/#([^\s,]+)#/,-1,1)[R1]/, [Orchester], regex(Swap([Albuminterpret]),/#([^\s,]+)#/,-1,1)[R1]/, regex(Swap([Dirigent]),/#([^\s,]+)#/,-1,1)[R1]/, [Orchester])) ([Abtastrate])
While it is clear that a backslash has to be replaced by a slash to force a directory change on MAC, the regex form
regex(replace([Album],:, / /-),/#([^\s,]+)#/,-1,1)[R1]
generally does not work on MAC.
To my assumption the slashes generally cause the problem and are not accepted in a MAC environment. But how can I force a blank space in replace([Album],:, / /-) and how can I build an expression in regex() when it is not possible to use /# and #/ to surround the entire regular expression?
Thank you for any hint or help.
Martin
blgentry:
It's unclear to me what you are trying to do. The expression at the top is pretty big! :)
If you can break this down to the interior expression that you are having trouble with, and explain exactly what the expected input and output is, I might be able to help.
I believe that forward slash is the escape character in MC. So to print a literal slash, you need two of them, like // . You can also make any expression use a literal string. You can also use /#literal text here#/ in ANY expression (not just regex). See the notes here for more info:
https://wiki.jriver.com/index.php/Expression_Language#Expression_Language_Syntax
Maybe some of that will get you started towards your solution. If you would like me to try to help, please post more information as I requested above.
Good luck.
Brian.
MartinG:
Hi Brian.
Thank you for the quick reaction. Actually the jriver wiki is well known to me an what you see is the result of intensive study and learning by doing. ;D
OK, I try to explain my problem in different words.
To move files from disk A to disk B in a specific file structure, I use the jriver tool "Rename, Move & Copy Files". Within the dialogue you have the option to define directories, which I did and which works as wanted with the given long expression I copied for explanation into my text. However, this expression works pretty well and does what it is aimed to do for when I use the jriver Windows version inside the Windows surrounding.
But I do have a master license as there are also MAC computers in my home and I definitely prefer to work with a MAC. So all my music is organized and stored on a MAC.
Unfortunately the jriver wiki is focussed on Windows machines, so the help for MAC users is limited in terms of working with slashes. Again: The expression I wrote works well on a Windows computer... but definitely not on jriver for MAC.
As it is clear to me, that a backslash inside a MAC system has to be replaced by a slash to force a directory change, I replaced all backslashes by slashes where needed... but this did not lead to a well functioning script in the MAC surrounding! In the Windows surrounding the slash sign is used for different needs, as you already wrote. However, I do have to translate the script for my jriver MAC version and do not know how to replace the / sign.
To be more clear: The regex() command uses /# and #/ to surround the entire regular expression. But the MAC is not able to "understand" this. So it is with the / inside the integrated command replace([Album],:, / /-), where the / also is misinterpreted.
If you insert the expression in your Mediacenter, you will see what it does (as far as you use jriver either in the German translation or translate words like "Dirigent" by "Conductor" and so on).
However, if you just take the expression "replace([Album],:, / /-)"... meaning replace the : by a gap plus a - when found in the Album title, you will see that even this simple command does not work on a MAC. The jriver MAC version seems to think, that you want to change directory twice or somewhat like this while the Windows machine exactly knows what to do.
Example:
While within Windows the term "Beethoven: Symphony No. 9" gets conversed correctly into "Beethoven - Symphony No. 9", with a MAC system the preview windows shows that it is going to make a sub-sub-folder like this "Beethoven//- Symphony No. 9". And with a more complex phrase like regex(replace([Album],:, / /-),/#([^\s,]+)#/,-1,1)[R1] the system can't work at all and completely gets confused.
Long talk, short sense:
How can I get the MAC version understanding the / correctly inside an expression? This is my problem.
Hope it got more clear now.
Thanks for your help.
Martin
blgentry:
I understand a little more now.
This is complicated because RM&C does weird stuff with expressions. I have had numerous instances where I tried to write expressions and then use them in RM&C. In expression columns, the expressions work correctly. But once inside RM&C they don't do what I expect.
Expression columns are the primary way I test expressions. That way I can quickly develop the expression I need, modify it, see my results, and interrate until I get it right.
I just tried your simple "replace" expression in an expression column. I expected it to do weird stuff. But it worked! I also tried this version, which also worked well:
--- Code: ---replace([Album],:, /# -#/)
--- End code ---
I didn't know exactly what to do with RM&C to test that. It gets more complicated: You see, RM&C has some "magic" built in to it. For example, when RM&C sees the colon character ( : ) in a filename (anywhere in the file name) it replaces it with an underscore character ( _ ) . So I'm not even sure that your expression applies. Meaning that, in the filename itself, you should never see a colon character, because they aren't legal in the windows file system and MC already translates them to underscores. So... I'm left a bit confused.
I'm not sure how to advise you on this... I'm pretty good with expression language, but RM&C makes it very, very confusing. First because of it's magic behavior. Second because it's done lots of weird stuff with expressions in the past.
Brian.
MartinG:
Mhmmm... OK, let's do it with this simple example.
replace([Album],:, /# -#/)
If I insert the suggested line into my version of JRiver (25.0.114, 64bit running on MAC OS Sierra 10.12.6) in the RM&C dialog, the result looks like the screenshot I attached. So, this also does not work with a MAC.
However, now it should get clear what I try to do...
I just want to do the same with my JRiver MAC version, what I am able to do with the Windows version. AND PLEASE don't tell me: Use the Windows version if it works over there. ;)
THIS is no option for me and only is a workaround as it does not work with the MAC at the moment.
Navigation
[0] Message Index
[#] Next page
Go to full version