I'm stuck with my regex expression... \n\s*[\w\säöüÄÖÜß\-?] \n[\s*^GEB$|\s*^ADR$]
The expression should match every name within a line break and the leading keywords GEB or ADR. I do not understand why exactly it is not working for me. Here is a link to my try. It does not end with GEB or ADR and so it matches parts of it, which should not be matched. I do not get it.
The problem is, the name could start with e title and can have multiple spaces between the words. Also it is possible for the name to be separated with a '-'.
Thanks in advance!
CodePudding user response:
The 2nd pair [ ] should be ( ) instead?
I would start with simpler regex like:
\n([^\n] )\n\s*(GEB|ADR)
If this is not correct, please update your question with the expected found text parts.
Did you mean something like:
\n\s*([\w\s\.?äöüÄÖÜß\-?] )\n\s*((GEB|ADR))
No need for ^ after a \n, and use ( ) for grouping.