@@ -39,18 +39,21 @@ public abstract class KeyValueConfigBuilder : ConfigurationBuilder
3939 /// Gets or sets the substitution pattern to be used by the KeyValueConfigBuilder.
4040 /// </summary>
4141 public KeyValueMode Mode { get ; private set ; } = KeyValueMode . Strict ;
42+
4243 /// <summary>
4344 /// Gets or sets a prefix string that must be matched by keys to be considered for value substitution.
4445 /// </summary>
4546 public string KeyPrefix { get { EnsureInitialized ( ) ; return _keyPrefix ; } }
4647 private string _keyPrefix = "" ;
48+
4749 private bool StripPrefix { get { EnsureInitialized ( ) ; return _stripPrefix ; } }
4850 private bool _stripPrefix = false ; // Prefix-stripping is all handled in this base class; this is private so it doesn't confuse sub-classes.
4951 /// <summary>
5052 /// Specifies whether the config builder should cause errors if the backing source cannot be found.
5153 /// </summary>
5254 public bool Optional { get { EnsureInitialized ( ) ; return _optional ; } protected set { _optional = value ; } }
5355 private bool _optional = true ;
56+
5457 /// <summary>
5558 /// Specifies whether the config builder should cause errors if the backing source cannot be found.
5659 /// </summary>
@@ -60,14 +63,16 @@ public abstract class KeyValueConfigBuilder : ConfigurationBuilder
6063 /// Gets or sets a regular expression used for matching tokens in raw xml during Greedy substitution.
6164 /// </summary>
6265 public string TokenPattern { get { EnsureInitialized ( ) ; return _tokenPattern ; } protected set { _tokenPattern = value ; } }
63- private string _tokenPattern = @"\$\{(\w+)\}" ;
66+ //private string _tokenPattern = @"\$\{(\w+)\}";
67+ private string _tokenPattern = @"\$\{(\w[\w-_$@#+,.:~]*)\}" ; // Updated to be more reasonable for V2
6468
6569 /// <summary>
6670 /// Looks up a single 'value' for the given 'key.'
6771 /// </summary>
6872 /// <param name="key">The 'key' to look up in the config source. (Prefix handling is not needed here.)</param>
6973 /// <returns>The value corresponding to the given 'key' or null if no value is found.</returns>
7074 public abstract string GetValue ( string key ) ;
75+
7176 /// <summary>
7277 /// Retrieves all known key/value pairs for the configuration source where the key begins with with <paramref name="prefix"/>.
7378 /// </summary>
@@ -87,6 +92,7 @@ public abstract class KeyValueConfigBuilder : ConfigurationBuilder
8792 /// <param name="key">The string to be validated. May be partial.</param>
8893 /// <returns>True if the string is valid. False if the string is not a valid key.</returns>
8994 public virtual bool ValidateKey ( string key ) { return true ; }
95+
9096 /// <summary>
9197 /// Transforms the raw key to a new string just before updating items in Strict and Greedy modes.
9298 /// </summary>
0 commit comments