I came across a problem with regex that I cannot solve. I want to combine part of the configuration file, but only if it contains a special word:
{{START}} {{CONF1}}blah blah ..{{ENDCONF1}} {{CONF2}}blah blah ..{{ENDCONF2}} {{END}} {{START}} {{CONF1}}blah blah ..{{ENDCONF1}} {{CONF2}}blah specialword ..{{ENDCONF2}} {{END}} {{START}} {{CONF1}}blah blah ..{{ENDCONF1}} {{CONF2}}blah blah ..{{ENDCONF2}} {{END}}
here I want to combine the entire block containing the "special word"
{{START}} {{CONF1}}blah blah ..{{ENDCONF1}} {{CONF2}}blah specialword ..{{ENDCONF2}} {{END}}
playing with some drawing, I reached the exact opposite with the search boxes "everything that does not contain a space-time word", but not the opposite that I want: /
{{START}}((?!specialword)[\s\S])*?{{END}}
to be clear i want
{{START}}[\s\S]*?{{END}}
where is the part that matches
[\s\S]*?
must contain a “special word” to match the entire expression
source share