INTERACT FORUM

Please login or register.

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

Author Topic: "Find And Replace" with expressions ?  (Read 3192 times)

kstuart

  • Citizen of the Universe
  • *****
  • Posts: 1955
  • Upgraded to MC22 Master using preorder discount
"Find And Replace" with expressions ?
« on: February 25, 2013, 12:03:49 pm »

Can you use expressions in Find And Replace (for Fields) ?

In other words, "If exist blah blah, then replace [Description] with [Album]" and similar.

I'm basically looking for functionality similar to both Find And Replace, and Move/Copy Fields, but with a) only portions of the fields, and b) depending on certain conditions.

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: "Find And Replace" with expressions ?
« Reply #1 on: February 25, 2013, 12:14:08 pm »

Nope.
Logged
The opinions I express represent my own folly.

kstuart

  • Citizen of the Universe
  • *****
  • Posts: 1955
  • Upgraded to MC22 Master using preorder discount
Re: "Find And Replace" with expressions ?
« Reply #2 on: February 25, 2013, 12:42:36 pm »

Okay, so those are both as they appear.

So, is there a way to do the following:

If [Album] contains either a [ or a (

Then move that character - and everything after it - to [Description]

For example,

Album            Dark Side of the Moon [30th Anniversary Remaster]

becomes

Album            Dark Side of the Moon

Description    30th Anniversary Remaster

(I've previously seen it explained how to make a View based on these conditions, but not how to actually move the tag information based on these conditions.)

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: "Find And Replace" with expressions ?
« Reply #3 on: February 25, 2013, 01:04:21 pm »

Set Description first with:

   =Regex([album], /#^(.+?)(?:\s*\[(.+)\])?$#/, 2)

and then followup by changing Album with:

   =Regex([album], /#^(.+?)(?:\s*\[(.+)\])?$#/, 1)

Both are the same expression, with just the capture value changed.  You can setup two expression columns to see that it works.
Logged
The opinions I express represent my own folly.

kstuart

  • Citizen of the Universe
  • *****
  • Posts: 1955
  • Upgraded to MC22 Master using preorder discount
Re: "Find And Replace" with expressions ?
« Reply #4 on: February 26, 2013, 04:38:37 pm »

I think there is a problem with the Tag Window editing style for "Description" Tag.

No matter what I do, the "Description" stays as - literally :

 =Regex([album], /#^(.+?)(?:\s*\[(.+)\])?$#/, 2)

Unlike other tag editing, Description puts "Enter" into the string as a carriage return, so there seems no way to cause the expression to "execute".

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: "Find And Replace" with expressions ?
« Reply #5 on: February 26, 2013, 04:57:53 pm »

After you enter the expression, just close the box and it will evaluate.
Logged
The opinions I express represent my own folly.

kstuart

  • Citizen of the Universe
  • *****
  • Posts: 1955
  • Upgraded to MC22 Master using preorder discount
Re: "Find And Replace" with expressions ?
« Reply #6 on: February 26, 2013, 06:10:45 pm »

Aha - I had a space at the beginning.  It does calculate when you close the box.

So far so good, it is definitely helpful.

What would be ideal would be an expression that:

* Started on the left end (IIRC smallest numbered character ?)
* When it encountered either a " [ " or " ( " or " { "
* Put everything else to the right, into Description - even if there are more of those characters

For example, I might have something like:

Dark Side of the Moon  (2003 remaster) [FLAC] {Doug Sax mastering}

and want everything after the first parenthesis to be in Description.

the cleaned up result that you provided previously (in other words, with brackets removed) is great, but not strictly necessary if multiple ones causes it to be too complicated.

Thanks !

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: "Find And Replace" with expressions ?
« Reply #7 on: February 26, 2013, 06:18:50 pm »

Use the following:

   =RemoveCharacters(Regex([album], /#^(.+?)(?:\s*[[({](.+)[\])}])?$#/, 1),/(/)[]{})

same as before 1 for Album, 2 for Description.
Logged
The opinions I express represent my own folly.

kstuart

  • Citizen of the Universe
  • *****
  • Posts: 1955
  • Upgraded to MC22 Master using preorder discount
Re: "Find And Replace" with expressions ?
« Reply #8 on: February 26, 2013, 08:58:20 pm »

Works perfectly !   :o  :o

I hope some other readers have a use for this !

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: "Find And Replace" with expressions ?
« Reply #9 on: February 26, 2013, 09:50:14 pm »

MrC and his wonderful toys again.  ;)
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: "Find And Replace" with expressions ?
« Reply #10 on: February 27, 2013, 01:04:32 pm »

Apparently I've always been mesmerized with and bewildered by toys.

Logged
The opinions I express represent my own folly.
Pages: [1]   Go Up