How does permalink normalization with regex work?

You don’t need a \2. And you need a \ before the period that you’ure searching for. You’ve got only one thing in parentheses. Maybe something like

/^(/threads/)[^.]+\.(\d+)/?$/threads/\1