Home > Mobile >  Regexreplace all lowercase words not working with german umlauts
Regexreplace all lowercase words not working with german umlauts

Time:11-10

Trying this to replace all lowercase words is not working properly

=regexreplace(A1;"\b[a-züöäß] \b";"")

Example sentence:

Mit Sätzen wie Gewinne laufen lassen Verluste begrenzen können vor allem weniger erfahrene Aktienkäufer oder Börseneinsteiger die wichtigsten Grundregeln des Aktienhandels kennenlernen und besser verinnerlichen.

also matches "ätzen" in "Sätzen" but Sätzen start with uppercase. Or matches "Aktienkäufer" to "Aktienk".

CodePudding user response:

My guess is that the word boundaries are not working as expected because the German umlaut characters are considered non word characters. Try this version:

=TRIM(SUBSTITUTE(REGEXREPLACE(SUBSTITUTE(A1, " ", "  "), "(^| )[a-züöäß] ( |$)", ""), "  ", " "))

CodePudding user response:

This is working

=INDEX(TEXTJOIN(" "; 1; LAMBDA(x;IF(REGEXMATCH(x&""; "^[a-züöäß]");;x))(SPLIT(A1; " "&CHAR(10)))))
  • Related