I’m trying to strip a string of all special characters except a few, plus remove everything between brackets (square, or any other, Including the brackets!). My current regex is:
^[a-zA-Z0-9äöüÄÖÜ;@.]*$
\\[.+\\]
\\<.+\\>
\\s+
All sequences that match one of the above are removed
It works fine on e.g.:
Foo Bar[Foo.Bar@google.com]
reducing it too FooBar but not on e.g.:
Foo
foo@bar.com
removing them completely
Update: Updating regex as per OP’s edit.
You can use the following regex and replace the match with empty string.