Regex Required: SPACE • DOT


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.


Breaking it down into captures.

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


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:

Your task can use the same expression.


Then use:

$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 :slight_smile:


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.


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. :stuck_out_tongue:

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

Thanks again!