The part between the
/s is fairly self-explanatory, since it's the regex from your original question.
normal gngq at the end is somewhat interesting.
gn will select the next match of the regular expression, and
gq, of course, formats this selection (as you mentioned in your question).
:g is the really great part. This is, in my opinion, one of Vim's most useful features. The
g ex command takes a regex and an Ex command, and it executes the command on every line the regex matches. If you haven't learned about
:g already, I highly recommend doing so, as it'll vastly increase your productivity. A few resources are Vim's own
:help :g or Power of g on Vim wiki.