More > JRiver Media Center 26 for Mac
RegEx Find & Replace
Sangie:
I can't figure out how to use Find & Replace with RegEx. I'm wanting to replace all instances of the following to a semicolon in the artist field:
&, feat., vs., feat, vs, pres.
This way artists can all be tagged properly.
RoderickGI:
You could do each variant one at a time just using the Replace() function in the [Artist] column.
=Replace([Artist],/&/,,;)
Would fix the "&," instances. i.e. It will convert;
Angelo Badalamenti &, Barry Short;Mary Long &, Fred Wide
to
Angelo Badalamenti;Barry Short;Mary Long;Fred Wide
Test using an expression column first, then apply to the [Artist] column.
Backup your Library before testing and applying to all files though!
PS: I only suggest this because I can't write Regex! ;D
Sangie:
--- Quote from: RoderickGI on June 24, 2020, 11:55:01 pm ---You could do each variant one at a time just using the Replace() function in the [Artist] column.
=Replace([Artist],/&/,,;)
--- End quote ---
Artist column? I'm talking about the tool Library Tools -> Find and Replace. Sounds like you're describing a better way. Would you mind going into further details?
RoderickGI:
Sorry, I focused on the Regex part of your post. I've been playing with too many MC functions and Regex lately.
The "Library Tools -> Find and Replace" function will do what you want, without the need for Regex. Just select the [Artist] field and set the Find to " &, " and Replace to ";" all without quotes, but note the spaces. You can apply that to just one file, and if it works, apply it to many. Then repeat for all variations you want to fix.
What I'm talking about is the ability of MC to update fields themselves by editing the field and entering an Expression, prefixed by an equals sign, into the field. What I would call "In Place Editing". MC reads the content of the field, applies the Expression to it, and write it back to the field. It's a neat trick, and the way I do most edits of that type. Hence I didn't think of the "Find and Replace" function when I read your thread.
One advantage of using the "Find and Replace" function is that you don't have to worry escaping certain characters like "&" and "," using the "/" Escape Character, which is why my expression included "/&/," which escaped the "&" and "," characters, preventing them from being treated as part of the expression function.
The attached image shows another example using your " feat., " variant, which escapes the spaces either side so they are also removed.
Sangie:
--- Quote from: RoderickGI on June 25, 2020, 12:50:24 am ---The "Library Tools -> Find and Replace" function will do what you want, without the need for Regex. Just select the [Artist] field and set the Find to " &, " and Replace to ";" all without quotes, but note the spaces. You can apply that to just one file, and if it works, apply it to many. Then repeat for all variations you want to fix.
--- End quote ---
It will do it one at a time which will be annoying. I want it to look for a list of conjunctions that could appear between artists.
--- Quote from: RoderickGI on June 25, 2020, 12:50:24 am ---What I'm talking about is the ability of MC to update fields themselves by editing the field and entering an Expression, prefixed by an equals sign, into the field. What I would call "In Place Editing". MC reads the content of the field, applies the Expression to it, and write it back to the field. It's a neat trick, and the way I do most edits of that type. Hence I didn't think of the "Find and Replace" function when I read your thread.
--- End quote ---
Okay so I go to "Add Expression Column" then put in the expression? Okay that's cool. But is it editing the tags directly in the file or just changing how I see it within MC?
Navigation
[0] Message Index
[#] Next page
Go to full version