How can I pass a query string from the url to a hidden user form field?
You may be able to do a hook_form_alter() and call \Drupal::request()->query->all() (or \Drupal::request()->query->get('reg-id')) to access the query parameters to pass it to your hidden form field. 

See https://api.drupal.org/api/drupal/vendor%21symfony%21http-foundation%21Request.php/property/Request%3A%3Aquery/8.2.x and https://www.drupal.org/node/2150267.

For example:

use Drupal\Core\Form\FormStateInterface;

/**
 * Implements hook_form_alter().
 */
function example_form_alter(&amp;$form, FormStateInterface $form_state) {
  // Get the query parameter with 'reg-id' if it exists.
  if ($custom_id = \Drupal::request()-&gt;query-&gt;get('reg-id')) {
    $form['hidden_field'] = // Do whatever you need here;
  }
}