Redirect rule for multiple slashes in the path [Merge slashes]

I'm trying to figure out how to define redirect regex/replacement rule for the frontend of the container.

What is the regex expression have to be to replace multiple slashes in the requested path?

Expected results:

Initial request: http://localhost///some////////example//path
Redirect to: http://localhost/some/example/path

Found the following regex expression useful for my case:
Expression: (.*:\/\/.*)\/\/+(.*)
Substitution: $1/$2

labels:
      traefik.merge_slashes.frontend.rule: 'Host:${PROJECT_BASE_URL}'
      traefik.merge_slashes.frontend.redirect.regex: '(.*\\:\\/\\/.*)\\/\\/+(.*)'
      traefik.merge_slashes.frontend.redirect.replacement: '$${1}/$${2}'
      traefik.merge_slashes.frontend.redirect.permanent: 'true'

Can anyone help me to understand more about this? How this substitution works? '$${1}/$${2}'