Deleting everything up to a character (REGEXP)


This is probably very basic, but I saw nothing in the FAQ about it, and I didn't have any luck with constructing a search string that produced results.

If I have a title of Recit: Bellissima Romilda (Serse), what is the regular expression to remove everything up to the first colon-plus-space?

And what would the regular expression be to remove everything from the last-space-plus-open-bracket to the end of the string?

I am almost certain it would be possible to construct a single regular expression to do both things, but I think seeing two separate ones would help me learn the principles better.

I want to end up with a title of just Bellissima Romilda, in other words.


Replying to your own posts is probably the first sign of madness, but I've managed to achieve the result I was after, despite not having a clue what I was doing! So if anyone else is ever minded to convert a track such as:

Recit: Some text (sung by Elvira) plain old

Some text

...then the answer was to create two actions.

First, the colon stripper: the action type is 'Format value', the field is TITLE, the format string is

$regexp(%TITLE%,^(.)(: )(.)$,$3)

Second, the bracket stripper: Action type is Replace with regular expression, the field is TITLE, the regular expression is


...and the Replace matches with is $1.

I figure the first example could be created as a 'replace with regular expression', too, in the same fashion as the second example. Or vice versa, I suppose. But this worked for me, so I'm not messing with it!


I'm looking for something similar and was wondering if someone could help. I want to strip anything within brackets including: [ ], { } , and ( ). Additionally, there could be multiple brackets within the filename.



I think you need no similar regexp function but a simple replace function.
Create an action group and in there a series of replace actions.
Each action should replace one of your desired characters to remove, e.g. replace '[' (open bracket character) by a ' ' (space character), and so on.
If double spaces would be created in this process add a last action to replace double spaces by one space.



Although you did manage to get it working, I will still reply with another way, which would probaly be faster if you are doing a lot of files.

You could replace everything with one "replace with regular expression":

Field: TITLE
Regular Expression: ^.+?:\ (.+?)\ (.+)$
Replace With: $1