I am dealing with MSSQL connection strings in different formats, and I need to be able to extract the password, whether or not it is wrapped in (single or double) quotes. I also
An infinite width lookbehind is actually works like this and is usually used like this: to make sure there is some specific pattern not immediately before the required pattern.
Thus, the optional pattern(s) at the end of a lookbehind always turn up in the consumed match.
You should use a consuming pattern instead:
/Password=["']?(.*?)(?:["'];|["';]?$)/gim
See the regex demo, extract Group 1 value.