INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Basic guidelines on using regular expressions (regex)  (Read 1487 times)

wnossel

  • Regular Member
  • Recent member
  • *
  • Posts: 13
  • nothing more to say...
Basic guidelines on using regular expressions (regex)
« on: August 12, 2012, 05:13:15 am »

What is the MC17 syntax to use regular expressions in "Library Tools/Find and replace"?

Let's say that I have a list of files with names in the "Artist" field as 'Cohen, Leonard' that I want to change to 'Leonard Cohen' (let's assume that they are that simple: last name, comma, space, first name).
As I see it, in the Find box I'd need something like: (.*),/s(.*)
and in the Replace box I'd put something like \2 \1

My question is: how would I apply this in MC?
How to use a regex in the simple context of Find/Replace?
I've read the following, but still don't quite get it - please forgive my dullness. Thanks in advance!

http://yabb.jriver.com/interact/index.php?topic=69678.0
http://wiki.jriver.com/index.php/Media_Center_expression_language#Specify_data_types_for_expression_based_fields
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Basic guidelines on using regular expressions (regex)
« Reply #1 on: August 12, 2012, 11:26:22 am »

Expressions are not supported in F&R.  Use in-field, or Tag Action Window assignment techniques.  The idea is listed in Reply 8 of the first link above.

First use the technique described - an expression column so that you can see and confirm the results.  Then, use the assignment technique (an expression starting with =).
Logged
The opinions I express represent my own folly.

wnossel

  • Regular Member
  • Recent member
  • *
  • Posts: 13
  • nothing more to say...
Re: Basic guidelines on using regular expressions (regex)
« Reply #2 on: August 13, 2012, 04:59:06 pm »

Great, that worked! Thank you.

But now I have another question on this assignment technique.
Let's say I make an expression column called FL returning the proper artist name. If I select the songs where I want to make the switch and if I type =[FL] into the Artist tag box on the left, all my artist switch to the text string "=[FL]". The switch works as I want it to only when I type inside the tag box the Regex function itself.

This works wells enough with short, simple functions, but must be very conductive to error with longer, more complex ones.
Is there a way to assign to a field an expression by using its given name or must we always write the expression in another column to test it and then paste the expression itself in the field to be changed?

Thanks in advance. W.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Basic guidelines on using regular expressions (regex)
« Reply #3 on: August 13, 2012, 05:14:52 pm »

Consider expressions to be evaluated when seen.  So if you create a new expression field, and use that field in some column, the expression is evaluated (and its results cached for performance).  If you want to use the results of an expression as a value, create a new expression user-field, entering the expression.  Then you can use that field's name elsewhere.

For one-time assignment, most of us find it easier to first create an expression column to test/edit.  This is really the only way to test the results of an expression.  When it works correctly, the expression can then be pasted after an = character (when editing a field) to perform assignment.
Logged
The opinions I express represent my own folly.

wnossel

  • Regular Member
  • Recent member
  • *
  • Posts: 13
  • nothing more to say...
Re: Basic guidelines on using regular expressions (regex)
« Reply #4 on: August 13, 2012, 05:19:28 pm »

Got it! Many thanks.
Logged
Pages: [1]   Go Up