It is driving me crazy and I have no idea what I am doing wrong. In my document I have to autoformat some regular expressions in and including the brackets.
An example is here;
[DP, 07.04.1911, „Protestanten“]
DP could also be BSZ, the date varies and the string in the quotation marks too.
I tried following grep expression:
\[(DP|BSZ)(.*)\]
This is working in all cases where there is only one such sequence in the paragraph. If there is a second it starts at the opening bracket of the first sequence and stops after the closing bracket of the second and everything in between those sequences is selected too.
What am I doing wrong? I tried to use the closing quotation mark as a stop, but it gives the same result. Here is the grep expression:
\[(DP|BSZ)(.*)(“*?)\]
.*
is greedy. So it will also match what comes afer them if theres a second instance of what comes after somewhere inthe text. Try.*?
instead