(?m)applies the following effective flags to the remainder of the pattern: gm m modifier: multiline. Causes ^ and $ to match the start and end of each line, not only the start and end of the string
^start of line
Sthe literal S (8310 / 1238 / 5316) (case sensitive)
\d+a Unicode decimal digit, repeated at least once
Qthe literal Q (8110 / 1218 / 5116) (case sensitive)
\d+a Unicode decimal digit, repeated at least once
g modifier: global. Finds all matches instead of stopping after the first