Sanitizing is now done through pattern matching rather than parsing the query and replacing the password in the query. This prevents accidentally redacting the wrong part of a query and revealing what the password is through association. Fixes #3883.