MySQL Connection URI Regular Expression
Just using your pattern on regex101, against the given examples on the documentation link you provided, the pattern fails for a lot of scenarios.

A few points to consider:


Pattern for valid IPv6 targets
Allow for percent encoding
\- You don't have to escape the hyphen if you move the - (hyphen) at the beginning or the end of matchset so that it does not act as rangeset.
Does not support an attribute in the URI in its current form



  PS: You can test the pattern against the given mysql examples for
  initial validations.