Help - Search - Members - Calendar
Full Version: Regex Required: SPACE • DOT
Mp3tag Forums > Mp3tag - International > Support
ragtag
When tagging multiple-disc albums, I usually let Mp3tag fetch the album name (or a portion thereof) from the %_directory% field, using the Format Value Action. The album name then may look something like this:

"The Ultimate Classical Album . CD1. Relax At Home"

The latter portion of the preceding album name i.e. "CD1. Relax At Home", is derived from %_directory%.

Now, I need to format this particular album field with the Mp3 tagging tools at hand, so that that the second DOT in the album field-- the one which follows directly after the CD-number, is preceded with a space. It should then look like this:

"The Ultimate Classical Album . CD1 . Relax At Home"

Could you please assist me with a regular expression, or another scripting function that will take care of this?

Your assistance is always greatly appreciated.
stevehero
QUOTE (ragtag @ Jan 11 2018, 13:09) *
"The Ultimate Classical Album . CD1. Relax At Home"

Breaking it down into captures.

To match The Ultimate Classical Album . CD1. Relax At Home


CODE
(?i)^(.+?[^\s])\s*\.\s*cd(\d+)\s*\.\s*(.+)



Then $1 will represent the first part
CD$2 the CD with no.
$3 the final part.

You can keep the same reg exp. Just fill in the format with section with whatever you want with either using the $1 $2 or $3.

EDIT I went a little overboard. w00t.gif

Your task can use the same expression.
CODE
(?i)^(.+?[^\s])\s*\.\s*cd(\d+)\s*\.\s*(.+)


Then use:
CODE
$1 . CD$2 . $3


In the replace with in the reg exp action.

Like I said it's overboard but you might learn something from this. But it will ensure that you've got the correct format in all your cases smile.gif
ohrenkino
Why don't you
replace all dots with blank-dot-blank in a first plain replace action and then
replace all double-blanks with a single blank in the next plain replace action. Done.
ragtag
Thank you to you both, stevehero and ohrenkino, for your quick responses.

Before I submitted my original post, I was already employing exactly the method proposed here by ohrenkino, but I thought there was an even quicker method. tongue.gif

Stevehero, I am going to experiment with your proposal as well. When you went "overboard" biggrin.gif in the beginning, it scared the wits out of me, but your final final expression may just save me step or two.

Thanks again!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.