RegEx in Javascript, Match multiline text between Tokens
With ((.|\n|\r)*?) you’re saying to take only the first character – a space, in the example.
On the other hand, ((.|\n|\r)*) you take any amount of characters (wich includes 2025-11-13too).
So you need a condition to stop:
.(?!^\d{4}-\d{2}-\d{2})
…tells to match any amount of characters if the current position is not of kind ^\d{4}-\d{2}-\d{2}.
Like said by @Barmar, you can simple use . with the s flag in replace to (.|\n|\r).
You’r code:
/^\d{4}-\d{2}-\d{2} ([a-z,]*)(.(?!^\d{4}-\d{2}-\d{2}))*/smig
Read more here: Source link
