I want to match all consecutive lines, prefixed with a space until a line starts without a space!
The problem is that the "end pattern" [^ ] is part of the match. The end pattern is a start-of-line not starting with a space.
The used pattern: (?im)(?:^( (?s:.*?))(?:^[^ ])) /g
See example at https://regex101.com/r/msVC5b/1
Please can anyone help me? I've spent hours and hours searching on SO and trying negative lookarounds ;)
\n\s+or\s+\n?/\A(.*?)(?=^(?! ))/sm/\A((?: [^\n]*\n)*)/