Two Regex Questions

I have two questions.

Question 1: regex pattern that will replace multiple consecutive spaces with a single space

Question 2: regex that will ignore parentheses but NOT ignore everything inside the parentheses.

so it would see: Lil Wayne (feat. Kanye West), and see this: Lil Wayne feat. Kanye West, how do I do this? WITHOUT removing the parentheses (because some songs have stuff like Remix in parentheses, and I want that to stay, I ONLY want it to remove the parentheses if feat is in between the parentheses)

also, do you guys know of a good book about the regex system you use so I can learn this myself?

you do not need regex for that as you replace text constants.
One is "(feat" replace with "feat".
and the other is " " (2 blanks) with " " (1 blank)

This action will replace multiple spaces with a single space and also remove any leading or trailing spaces.

Action type: Format value
Format string: $regexp($trim(%artist%),\s+, ,1)

(Make sure you place a single space between the two commas.)

This action should do it. The text within the parentheses has to match"(feat. xxxxx)" exactly , including the period. It could be made more flexible if you like: for example to also match "feat" without the period, or to also match "featuring".

Action type: Replace with regular expression
Field: TITLE
Regular expression: (.)((feat. [^)]))(.*)
Replace matches with: $1$2$3
[ ] case-sensitive comparison

That would probably be Introducing Regular Expressions. Here it is on Amazon.

There is also Mastering Regular Expressions, which is often considered the regex Bible, but it's more advanced and it's pricey. On Amazon.

The web site is very good for learning. I'd recommend starting there.

Is there any way the white space one can be made available for all fields without duplicating the action a million times?

Use the field _ALL

oh my god why didn't I think of that?! I tried using _TAG and it didn't work!

For online sources about RegEx (Regular Expressions), I would recommend two:

  1. This is the best source for RegEx that I know of:

I've learned almost everything about Regular Expressions with this single webpage.
It's very clear and contains examples about almost every possible scenario.

  1. However, Mp3Tag help system also has a good beginner's manual with all the important features of RegEx (perhaps all you need now). Look here, at the bottom:

Do not forget to learn from there ...

... especially there is a nice walk through ....
Regular Expressions


This is the best way to learn! --> Regex Crossword

It is interactive and the crosswords are progressive. It took me about two weeks to complete all nine of the crosswords, and I didn't know any regex before. It's a fun way to learn. Highly recommend it.

Here are some resources I used:

Because ...


... it does work also on _TAG alone.