An easy way around the newline issue is replacing newline characters with a space character before applying your regular expression, or replacing them with symbols that don't occur in the data naturally, so that you can restore them later if needed.
After that, i also made some adjustments to your regular expression, as it did not seem to do what you describe.
Here is my approach:
let data = `2025-11-13 bb Test.
2025-11-12 bb Mail von Test
testd
trest
Tes
2025-11-12 bb Mail v`;
data = data.replaceAll("\n", " ");
const pattern = /\d{4}-\d{2}-\d{2}\s+\S+\s+(.*?)(?=\s+\d|$)/g;
const matches = [...data.matchAll(pattern)];
matches.forEach(match => {
console.log(`"${match[1].trim()}"`);
});
I first replace newlines with a space, and then use a regular expression to match the pattern in your data like this:
\d{4}-\d{2}-\d{2} checks for valid dates
\s+\S+\s+ skips one group of non-whitespace characters as a more robust way of handling the bb's in your data
(.*?)(?=\s+\d|$)/g matches anything that comes after until we reach a word that starts with a digit (mainly dates of the next entry)
With that, i get an output that matches your desired output:
"Test."
"Mail von Test testd trest Tes"
"Mail v"
sflag will make.match newlines, you don't need to use(.|\n|\r).withsflag is that it will consume the whole string.s, it's from using*in the pattern.