Currently, the for loop iterates from 1...n, which is an issue, if n > 9.
Luckily, this so far was never an issue, since we typically have only one or two captures in dynamic context rules.
Additionally, the helper function to escape the regexp is removed in favor of QRegularExpression::escape().