1

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!

2

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.