<!--a5--> matches the characters <!--a5--> literally (case sensitive)
2nd Capturing Group
(.|\n)*
*matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
A repeated capturing group will only capture the last iteration. Put a capturing group around the repeated group to capture all iterations or use a non-capturing group instead if you're not interested in the data
1st Alternative
.
.matches any character (except for line terminators)
Line terminator(s) are \n
2nd Alternative
\n
\nmatches a line-feed (newline) character (ASCII 10)
3rd Capturing Group
(<!--5-->)
<!--5--> matches the characters <!--5--> literally (case sensitive)
Global pattern flags
g modifier:global. All matches (don't return after first match)
m modifier:multi line. Causes ^ and $ to match the begin/end of each line (not only begin/end of string)