Dependency Configuration File - Regex

Root > Secret Server
With version 7.8.00010 (and later), Secret Server allows a Secret to have file dependencies. File dependencies allow text files with embedded credentials to be changed via Regex.

A Regular Expression (Regex) is a phrase in a language for matching text. For details on the .NET Regex language, see this site:

Secret Server will replace the contents of the first group within the Regex.

Some examples of using Regex within File dependencies are below.

XML Config files
Regex: <UserName>Bob</UserName>\s*<Password>([^<]+)</Password>
    <User name="Bob" password="Password1" />
    <User name="John" password="Password1" />
Regex: <User name="Bob" password="([^"]+)" />
INI Files
name=John Doe
organization=Acme Widgets Inc.
Regex: name=John\sDoe\s*password=([^\r\n]+)
SQL Server Connection Strings
Data Source=myServerAddress;Initial Catalog=myDataBase;
User Id=myUsername;Password=myPassword;Server=myServerAddress;Database=myDataBase;
User ID=myUsername;Password=myPassword;Trusted_Connection=False;
Regex: Password=([^;]+)
Oracle Connection String
User Id=myUsername;Password=myPassword;
Regex: Password=([^;]+)
Oracle Connection String
Data Source=username/password@//myserver:1521/;
Regex: username/([^@/]+)
receipt:     Oz-Ware Purchase Invoice
date:        2007-08-06
name:   Dorothy
password:  Password1
Regex: name:\s*Dorothy\s*password:\s*([^\r\n]+)

Add Feedback