Regular Expression To Replace '['

Also had tried


to no avail as well... :frowning:

My %album% content is simply cuba [



also doesn't work... Helppp.... :frowning: :frowning: :frowning:

None of these works.. :frowning:

I have no idea about regex,

but if your %album% is "cuba [" and you want to remove " ["
just create an action

Action Type: Replace
Field: ALBUM
Original: " ["
Replace With: ""

Oh yeah.. eheheh..

Just forgot to state my original objective here... :laughing:

Actually the original idea is to remove lyrics timestamp..

[00:32.60]Through with being your fool 
[00:36.46]And I won’t do it no more 
[00:39.44]And I won’t..
[00:41.03]I won’t keep up this act 
[00:43.62]Not for one minute 
[00:45.93]I’m gonna pull,
[00:48.16]I’m gonna pull this curtain down

So, I've tested with TexPad with [[].{5,8}[]] -> '' and it works very well.

That's why I suspect the culprit is the '[' character.

So, I made a simple test to replace that '['.

Anyway, really appreciate your concern. Thanks. :slight_smile:

freekey, it looks like that you spend much time to try out things, which will not work per se.

Read the Mp3tag manual before you try to solve a problem, that is new for you.
Read the FAQ areas in this forum.
Read user questions and answers to learn from other people's examples.

While reading the Mp3tag manual, let you be guided by the offered syntax descriptions for using this or that function.
If you need further informations about general usage of computer or programming knowledge, which has nothing to do with Mp3tag in depth, then browse the internet to find an answer.

If you are working with Mp3tag scripting language, then take into account, that special characters from the character set are reserved for special tasks, e. g. square brackets, single apostroph, double apostroph, percent sign (documented in the Mp3tag manual).

Further more there are special restrictions when using the Regular Expression functionality.
A regular expression can be seen as a 'scripting language' for it's own.
To avoid collisions with the Mp3tag scripting language, a regular expression sometimes need 'escaping' of special characters.

Your examples from above demontrate that you did not learn how to drive your car and how to understand the meaning of the signs in the street, but anyway you are driving the car.

Now we take a look at your problem,
You want to remove some characters from a text line:
[00:32.60]Through with being your fool

You ask: "How can I remove the lyrics timestamp".
Some people ask: "How can I remove 10 characters from the left side of the string".
Others may ask: "How can I remove the leading part, which is enclosed in square brackets."

Mp3tag supports different tools to solve such approaches.

The following two examples are restricted to a single line only.
The textline is stored in a tag field "TEXT".

  1. Using simple scripting functions $len(), $sub(), $mid().
    If the timestamp has always the length of 10 characters, you can use an expression:
    This skips the first 10 characters and returns the remaining characters starting at position 11.

  2. Using Regular Expression function $regexp()
    This splits the incoming string into parts, detects the part which is indicated by the round brackets, then returns the value by the $1 referer.

If your problem would be such simple, then you have now all tools at hand to solve it.

But you want to do text processing with more than one line of text.
You want to manipulate multiple lines of text at once, which are stored in one tag field, previously read in from a text file.
This might be more complicated, because Mp3tag does not support repeated operations in one go on a tag field, will say, we cannot create a loop when processing one tag field content (there might be a possibility when exporting tag field content using the Mp3tag Export Scripting Language").

So only the usage of Regular Expression comes into mind, provided that the Regular Expression implementation within Mp3tag supports multi-line processing or at least placeholders for "CarriageReturn" and "LineFeed" characters.

Because the Mp3tag RegEx implementation allows the usage of \r \n placeholders, we can write such RegEx expression (there might exist other expressions, which will give the same result):
This removes all characters within the leading square brackets and the square brackets too at the beginning of each line.

You can apply it in Mp3tag e. g. using an action "Format value".
Action: Format value
Tag field: TEXT
Formatstring: $regexp(%TEXT%,'(\n|^)[.+?](.+?)(\r|$)',$1$2$3)

Final note as always:
Adapt the elaborated proposal to your needs.
Try out your scripting work with a test file.
If all works satisfying, then run your scripting work against your production files.


DetlevD, thank you very very much for your concern and lenghty explanation, I really appreciate that.. :slight_smile:

It's just that, I think your concern is too much beyond the original idea.

I know what you are trying to say. And I am aware of my peculiar behavior to get things work as I hoped, :laughing:

FYI, I spent about 2 hours trying out this thing. Coz I just could not stand that my regular expression cannot be properly executed though I've googled so many examples that my expression is sufficient enough to replace that '['.

Realizing that the problem should be simple to overcome, so I decided to ask in this forum with a hope that it can be solved.

Back to my problem, I also want to cater for older lyrics format which is in the format of [00:00]. What I need is really a simple explanation, how do I use $regexp in mp3tag to cater special character such as ']', ':' and so on. I do read the Help file and it says that I need to use the escape character ''.

So, why it doesn't work?


Thanks for your regexp suggestion, I will try it later since right I could not absorb the logic, huhu..

By the way, I do go for alternatives when one option cannot be implemented.

For example, in the case of my complaint against ID3V1 and IDV3V2 priority..

Today, I just got the solution which is:

  1. Put all those empty idv32 files in a playlist.
  2. Load them to mp3tag.
  3. Set only read id3v1, refresh.
  4. Export the value into a file.
  5. Turn on read id3v2 again.
  6. Use Text File - Tag function.
  7. Voila!
Sorry, I do not understand your message in relation to the message topic "Regular Expression To Replace '['".

Well in relation to this problem, likely the same as mentioned in e. g. ...


... it should be possible to shorten the process you have described.
Probably you can do all the work without leaving the current session of Mp3tag and without using an external filelist.


I'm sorry for being off topic.

I just try to clarify your points that seems to blame me for not going to alternatives way.

Anyway, regarding the issue. Yeah, of course I can set the mp3tag to just read the ID3V1 but write to BOTH ID3V1 and ID3V2, but I will lose those ID3V2 EXTRA TAGS that already written, wouldn't I?

By the way, I'm still waiting for the answer...

What is the correct way to find a match for '[' pattern by using Mp3Tag $regexp?

Thank you.

Ok DetlevD,

Thanks for the idea..

I've tested your suggested regexp, and it works but only for single occurrence of timestamp per row.

But it did not cater for a case like this..

[00:19.38][2:23.45]I know what you're doing

So, what i simply need is this..

'[.{5,8}]' ---> '' to remove those timestamps.

And the only thing I missed before is that single quote enclosing the search string.. Too bad.. :frowning:

Thanks for giving me the idea.

By the way, please take note that Mp3Tag does work for that multiple line '%unsyncedlyrics% field.

Thank you.

:astonished: I do not think so.

You have to take into account the different dialects of RegEx implementations.

Very often scripting programming languages and code are self explaining.

I gave you general working examples how to remove a starting "square bracket clamb" of any length on each line of a text.

The finishing touches are left to do by yourself.

Read there about usage of characters in Regular Expression:

Well, freekey, in this article ...
Regular Expression To Replace '['
... I gave you all tools at hand what you need to solve the originally problem that was with a timestamp at the beginning of each line of text in an UNSYNCEDLYRICS tag field.

RegEx's which might be helpful.

Example string ==> Mp3tag RegEx string
[00:00] ==> '[\d\d:\d\d]'
[12:34.56] ==> '[\d\d:\d\d.\d\d]'

... to combine both cases ...
[00:00] or [12:34.56] ==> '[\d\d:\d\d]|[\d\d:\d\d.\d\d]'
[00:00] or [12:34.56] ==> '[\d\d:\d\d(?:.\d\d)?]'

... or just simply ...
[any content] ==> '[.+?]'


I am very sorry Sir for putting you in such a very long argument.. :frowning:

Actually, that's the only thing I need or specifically as I've posted earlier.. [.{5,8}]

But my very very very super bad is just that I don't put them in a quote '. That's the only problem in the first place actually.. :frowning:

I am very sorry and thanks a lot for your help.

Just as it was initially desired.

This looks like a corrupt line.
Those wrong cases you should sort out separately.


Erm.. Nope, it's a valid one.

Means that the song would go for the same lyrics again.

It could be more than 2 times as well :laughing:

Well, freekey, it looks like you got it ... for now.

You see that there are two stages of escaping to consider:

  1. Escape all characters which have to be escaped for usage within a Regular Expression by prefixing one Backslash.
  2. Escape all special characters which are reserved within Mp3tag by enclosing into a pair of Single Apostrophes.

So if you want to detect this string by a Regular Expession ...

... this is a sequence of literal characters ...
Opening Square Bracket, Digit One, Point, Digit Two, Closing Square Bracket

... then you need to escape ...

... or to find other digits too ...
Opening Square Bracket, Digit, Point, Digit, Closing Square Bracket
The dot and the square brackets are escaped to tell the RegEx machine, that these characters have to used literally and not as a RegEx command.
The \d tells the RegEx machine, that there is a generic digit expected, not the character d.

The Mp3tag manual tells you about escaping special characters too.
For example, the square brackets have a special function within Mp3tag.

Therefore the already RegEx prepared pattern have to be escaped for the usage within Mp3tag.

... to simplify this step, even for better readability it is allowed to write ...


Before you got struggling hours for hours to put a multiplier into the RegEx pattern at the right place, I suggest you let the action run twice or more (simply duplicate the one action module).