INTERACT FORUM

Please login or register.

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

Author Topic: Carnac and regular expressions  (Read 1529 times)

mattlovell

  • Galactic Citizen
  • ****
  • Posts: 330
Carnac and regular expressions
« on: March 31, 2017, 09:17:47 am »

Hello,

Did anything ever come from the suggestion (back to the end of 2011) of adding regular expressions to Carnac?

I ask since I have a directory structure, for a subset of my classical music, that has files in varying depths of directories, but I'd like to extract the Composer name from the "top-most" directory.

Files generally reside in a structure like the following:

Opera\<Composer>\<File>

but there are times that an additional directory gets added to the path:

Opera\<Composer>\<Collection name>\<File>

and I would still like to extract the Composer properly.  The filenames also often have a Conductor present, parenthetically, after the name of the work.  It would be nice to be able to extract that field as well.

Any suggestions?

Thanks!
  Matt
Logged

mattlovell

  • Galactic Citizen
  • ****
  • Posts: 330
Re: Carnac and regular expressions
« Reply #1 on: April 12, 2017, 11:56:43 am »

Did anything ever come from the suggestion (back to the end of 2011) of adding regular expressions to Carnac?

Reading through older forum posts, I came across a tidbit I didn't realize -- namely that one can enter an expression when editing Tags!!

Using the expression

=regex(FilePath(), /#Opera\\([^\\]*)#/, 1)

gets Composer filled in correctly for all files!  Based on directory structure, I've always populated opera and other classical music into an F:\Opera directory.  The regular expression above picks off the first-level directory name.

(Carnac's templates, FWIW, appear to be anchored at the end of the filename.  So, it wasn't handling the varying directory depth present within a given composer's folder.)
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Carnac and regular expressions
« Reply #2 on: April 12, 2017, 05:21:46 pm »

One of the things that makes MC such a great tag editor is that it processes expressions right in the Tagging Window.  It's very, very powerful as you have just found out.  :)

Brian.
Logged
Pages: [1]   Go Up