如何編寫正則表達式以從連接字符串中檢索密碼。正則表達式從連接字符串中檢索密碼
連接字符串是這樣的:
USER ID=system;PASSWORD = ab;DATA ..
或
USER ID=system;PASSWORD=ab;DATA ...
或
USER ID=system;PASSWORD =ab;DATA...
或
USER ID=system;PASSWORD= ab;DATA ...
試過了使用ConnectionStringBuilder的方法。適用於SQL Server。但在甲骨文的情況下,拋出此異常:
Invalid length for connection option 'Data Source', maximum length is 128.
的Oracle連接字符串:
USER ID=sa;PASSWORD=abc;DATA SOURCE="(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.1)(PORT = 8080))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = Orcl)))"
那麼密碼從不包含分號或空格? – BlueM
使用'SqlConnectionStringBuilder'類可能會更容易:http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnectionstringbuilder.aspx –
Stackoverflow不適用於'寫我的代碼' – sra