INTERACT FORUM

More => Old Versions => Media Center 16 (Development Ended) => Topic started by: AndyU on October 10, 2011, 10:37:22 am

Title: Removing the first word from a field
Post by: AndyU on October 10, 2011, 10:37:22 am
Hi

I have many classical albums which I have, for historical reasons, tagged the [Name] fjeld as "Composer Work ..". For example, "Beethoven Sympohny No 3". Now I use J River and can show the Composer separately, I'd like to remove or hide the first word of each Title.

I can't find a function that will let me do that - I would like an 'INSTR' one that returned the position of the first space character in a text string so that I could then take the right hand portion of that field.

Any ideas?
Title: Re: Removing the first word from a field
Post by: vagskal on October 10, 2011, 11:45:15 am
Hi again,

Now we need the Regex() MC expression. Try something like this:
Regex([Name],/#^.*? (.*)#/,1)
Title: Re: Removing the first word from a field
Post by: AndyU on October 10, 2011, 02:11:04 pm
Thank you! I tried exactly that, and it worked. Splendid!

Can I ask you for a wee bit more ...

for many of these Classical titles, I also appended the name of the artist, eg (Mullova). Can you add to your Regex expression some magic to remove this, if it is present, so

Beethoven Piano Concerto No 3 (Brendel)

becomes

Piano Concerto No 3

Thanks again.
Title: Re: Removing the first word from a field
Post by: vagskal on October 10, 2011, 04:20:14 pm
It is late right now where I live, and I do not have any reference at hand. But you could try this:
Regex([Name],/#^.*? (.*) /(.*?/)$#/,1)

Try reverting the /( and /) if that does not work, i.e. \( and \).

MrC is really the Regex() guru here and he might work "the night shift", i.e. be in a different time zone.
Title: Re: Removing the first word from a field
Post by: AndyU on October 10, 2011, 05:47:16 pm
Brilliant! The \( and \) worked. Don't know where you are - if you're ever in Scotland I'll buy you a pint. Whoever pays you should pay you more. Thank you  :)
Title: Re: Removing the first word from a field
Post by: JimH on October 10, 2011, 05:54:09 pm
There's more here:
http://wiki.jriver.com/index.php/Media_Center_expression_language
Title: Re: Removing the first word from a field
Post by: marko on October 11, 2011, 12:46:45 am
Andy, whereabouts in Scotland are you? I'm in Edinburgh. Good to see a fellow Scot on the forums :)

-marko
Title: Re: Removing the first word from a field
Post by: vagskal on October 11, 2011, 02:32:22 am
Glad it worked for you.

I live in Stockholm, Sweden, so it was not _that_ late. I am just a user. I do not get paid for this. It is a hobby, like beer drinking.

And you should have a look at Marko's excellent reference page that Jim linked to. Much to learn there.
Title: Re: Removing the first word from a field
Post by: AndyU on October 11, 2011, 04:07:29 am
Marko - I'm in Glasgow, not so far ... I studied Computer Science at Edinburgh many decades ago - almost the first Computer Science course there ever was - Edinburgh Uni had it's own language called IMP and I typed my programs onto punched cards. In those days I'd have read your guide, stayed up all night, taught myself regular expressions, I dare say written my own parser and got it all to work .. now, one of the small advantages of being (a lot) older is that I have no shame in asking for help. Thanks again guys.
Title: Re: Removing the first word from a field
Post by: JimH on October 11, 2011, 06:37:49 am
Andy, whereabouts in Scotland are you? I'm in Edinburgh. Good to see a fellow Scot on the forums :)

-marko
I believe weehappypixie is also a Scot.
Title: Re: Removing the first word from a field
Post by: JimH on October 11, 2011, 06:41:32 am
... have a look at Marko's excellent reference page that Jim linked to. Much to learn there.
That's a combined work of both Marko and MrC.  It's an amazing work.
Title: Re: Removing the first word from a field
Post by: vagskal on October 11, 2011, 09:52:05 am
That's a combined work of both Marko and MrC.  It's an amazing work.

Of course. Sorry about that, MrC.
Title: Re: Removing the first word from a field
Post by: harrydr on October 11, 2011, 05:38:36 pm
Simple MC user from the beginning, love it.
Thanks for the link JimH a lot to learn. We drink Rum And Coca Cola in the Dominican Republic.