Here, we capture the id group with (?<id>\d+) and reuse the id value later in the regex with \k<id>.

In order for .* to match newline chars, it is necessary to turn on Singleline mode. This, in turn, means we have to be specific about our newlines. In Singleline mode, these can be accounted for in a non-platform specific way with \r?\n.

Email codedump link for Regex get group block with specific start and end each group