Replacing Composer birth/death-dates

I am pretty new to regexp and trying to figure out how turn something like:

Brahms, Johannes (1833-1897)
Johannes Brahms

Turninga round first/last names I found something, but I struggle to get rid of those bracketed dates.

I'd appreciate a bit of help.

Many thanks

you could try:
$regexp('Brahms, Johannes (1833-1897)','(.*), (.*) \(\d+.*',$2 $1)
Or for an action of the type "Replace with regular expression":
Search string: (.*), (.*) \(\d+.*
Replace string: $2 $1

1 Like

That worked many thanks.

Just for me to understand: Is the Backslash ("\") used to get rid of characters. The first two bits (turning around last and firstname) I had figured out, but did not know how to remove the "third" bit (Dates).

1 Like

the Backslash turns the following character into literals, "escapes" them.
You see that the first brackets were used to address the string parts to be turned around. Then the string contains an opening bracket plus a number plus further characters. But the opening bracket is to be taken as that what it is: a bracket and not as part of the expression syntax.
See further information in the help:


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.