INTERACT FORUM

Please login or register.

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

Author Topic: Wildcard in Find & Replace Library tools  (Read 3481 times)

Three

  • Recent member
  • *
  • Posts: 47
Wildcard in Find & Replace Library tools
« on: February 17, 2017, 11:54:07 am »

Is there one?
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Wildcard in Find & Replace Library tools
« Reply #1 on: February 17, 2017, 05:42:51 pm »

You might want to give an example of what you want to do.  I don't know what you're asking.

Brian.
Logged

Three

  • Recent member
  • *
  • Posts: 47
Re: Wildcard in Find & Replace Library tools
« Reply #2 on: February 19, 2017, 01:45:44 pm »

My song titles include the date. For example, 9 de Julio - 1929. What I want to do is copy all of my song titles into another field, say Custom, but without the date, so for example I would like to have 9 de Julio in the Custom field. I would also be content to copy the entire song title into Custom and then do a search and replace eliminating the - 1929. Of course the problem is that I have 20,000 songs, and the dates range from 1900 to 2016.

Thanks
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Wildcard in Find & Replace Library tools
« Reply #3 on: February 19, 2017, 03:44:17 pm »

You can use an expression to do that.  Are they all formatted like your example with exactly one dash and then a 4 digit date?

If so, a really naive expression would just chop off the last 7 characters (space, dash, space, 4 digits).

If you could give 3 or 4 examples, I could probably help you with an expression to remove the date from the title and put it into another field.

Brian.
Logged

Three

  • Recent member
  • *
  • Posts: 47
Re: Wildcard in Find & Replace Library tools
« Reply #4 on: February 19, 2017, 04:11:15 pm »

I want to keep the date in the title. But, I want a second field which has only the title without the date. And yes, they are all formatted the same way: a space, a dash, a space then four numbers. I know there is a language, kinda like the excel text manipulation language, (regular expressions) which allows for text manipulation, but can not figure out how to apply it in a search and replace setting. And yes, I was thinking that I globally search for the pattern, then chop the last collection of characters. And a search is required since perhaps 15-20% of the titles currently do not include the date.

Thanks
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Wildcard in Find & Replace Library tools
« Reply #5 on: February 19, 2017, 05:01:35 pm »

The Expression Language is what lets you do things like this:

https://wiki.jriver.com/index.php/Expression_Language

Regular Expressions, or regex, are one feature of the Expression Language.  Kind of a favorite of mine actually.  I just did a very limited experiment and wrote and expression that strips the ending date from the [Name] field.

To test this, make a new field, or an expression column.  Then paste in this expression:

Code: [Select]
=if(regex([Name],/#(.+)(\s*-\s*\d\d\d\d\s*)$#/),[R1],[Name])
That worked on my test cases.  I would expect it to work on your data too, unless there's something unusual I didn't account for.

Good luck,

Brian.
Logged
Pages: [1]   Go Up