The coefficient + following the atomic group means that the regular expression mechanism will try to match the pattern within the group one or more times. This is different from the second expression, in which the engine will try to immediately match the pattern.
+ ? not followed by a lazy modifier ? , therefore, it will correspond to greed, that is, how many times.
The group was probably made atomic because, like a non-exciting group, it prevents any retreat after each full match of the entire subexpression.
If or when \n* at the end of the group does not match a newline, due to + engine will start trying to match the group again from the very beginning. If this fails, then, since the group is atomic, the existing match will be returned.
If the group was not atomic, the engine would roll back to try another way of comparing what was just successfully matched before trying to reconcile the beginning of the group again.
For example, if the last three characters match the new characters, \n* , he must first give the last one and try again to match the beginning of the group. When this fails, you will get another new line and try again, and so on.
The return will continue until the sequence (.+\n)* , and because of the flexibility as what matches . , and the number of matches of the + and * characters, there will be so many ways that the engine could match the pattern before trying to match again.
The same part of the string can be matched by the entire sub-expression in different ways, and therefore, a huge amount of inefficient, time-consuming return path can occur before the engine can make sure that further matching is not possible.
The designation of the atomic group means that this can be avoided.