I'm trying to create a regular expression in C# that will replace the password of a connection string so that it is not shown when I display it on a page. The connection string password are somewhere in the string as PWD=password;
So far I have:
Regex.Replace(connStr, "PWD=.*;", "PWD=********");
This works to find the beginning of the pattern, but the problem is the wild card (.*) is also including the ; so the pattern is never terminated and the remainder of the string is replaced too. How can I say everthing but a ; in my RegEx?
Thanks.

