I have a String that contains a (first and last) name, which I exclusively want to extract. This is the only instance, where two words in a row start with capital letters. I thought it would be easy enough to use replace with regex \b[A-ZÄÖÜ][a-zäöüß]*\b\s+[A-ZÄÖÜ][a-zäöüß]*\b
. While this regex extracts the name correctly I cant for the life of me figure out how to “inverse” it. In the past I used a nested replace: I deleted what I wanted and replaced everything that was left with “”. But in this case this approach doesn’t seem to work (probably because the name is right in the middle of the string). I spent hours trying to figure out the “negative” Regex, but even with the help of ChatGPT and countless tutorials I didn’t manage to solve it that way either.
I considered using the text parser module, but since I am working with an iterator/aggregator setup this would cost several hundred to over 1.000 operations per run insted of 6 if i manage to do it within the textfield with the string functions.
Maybe someone here is able to help me with the regex or give some advice on how to work around this issue.
Thanks a ton in advance!