More > JRiver Media Center 27 for Mac

Library field and how to trim a field -> get a tex from a multi value field

<< < (4/4)

zybex:
If you want to keep the roles for the remaining entries, you can also do this:
listRemove(listremove(listremove(listremove([Performer],/(orchestra,2),/(choir,2),/(conductor,2),/(composer,2)

This returns:
Alison Browner (alto vocals);Wilfried Jochens (tenor vocals);Markus Schäfer (tenor vocals);Angela Kazimierczuk (soprano vocals);Peter Lika (bass vocals);Franz-Josef Selig (bass vocals)

Where the previous Regex one will return just the names:
Alison Browner;Wilfried Jochens;Markus Schäfer;Angela Kazimierczuk;Peter Lika;Franz-Josef Selig

(just noticed that the ListRemove() documentation is wrong. The working syntax is ListRemove(List, String|Index, Mode), with just 3 args for all modes)

wer:
I don't have access to MC atm so I was just doing this from memory; I can't test any of it. If -2 is not case sensitive that's helpful. I just gave something I thought likely to work.

I have seen the MC regex implementation do some squirrelly things with negative lookaheads and lookbehinds in the past, so I wouldn't want to quote those to people too much without testing in MC. Not sure that support is robust.  I do remember it does not support some of the common flags, like \K to drop a match.

Henning, all of this goes back to something that I told you earlier: it is not difficult to formulate a perfectly good regex that works properly in all the online evaluation engines, but does not work in MC. So you could well find "cut and paste" examples elsewhere on the web that are in fact correct, but still don't work in MC.  This is a reality we just have to work around.

zybex:

--- Quote from: wer on December 22, 2020, 03:28:27 pm ---I have seen the MC regex implementation do some squirrelly things with negative lookaheads and lookbehinds in the past, so I wouldn't want to quote those to people too much without testing in MC
--- End quote ---

Indeed. I'll add to this that lookaheads/lookbehind can be a bit dangerous because they can cause the Regex evaluation to take an exponentially long execution time with some input strings. If MC doesn't run them with a timeout it can cause it to hang or become sluggish if you're unlucky and have some weird field content. Other Regex constructs such as chained masks "(.+?).*" are also dangerous and should be avoided.

zybex:
Shameless plug to my Expression Editor tool:
https://yabb.jriver.com/interact/index.php/topic,125975.msg872893.html

@henning65, you might find that useful as a playground to develop expressions :)

EDIT: ... for Windows.

Navigation

[0] Message Index

[*] Previous page

Go to full version