Barkermn01
Barkermn01

Reputation: 6842

Nice and Simple RegEx I can't work out

I'm trying to build a QueryString Reader from my app.config in the most part I have it working now I'm trying to add other config properties into the value E.G

<add key="Database[TableNames[Tracks]]" value="tracks" />
<!-- others... -->
<add key="Database[Querys[selectTracks]]" value="SELECT * FROM `{@Database[TableNames[Tracks]]}` WHERE track_id = '{0}'">

From the above I have the Key Database[TableNames[Tracks]] set and now I'm trying to use it in the value of Database[Querys[selectTracks]] but I can't figure out the RegEx I need to use to match it it cant be on all {.*} or {[A-Za-z0-9]} as this will match the String.Format {0} property and I don't want that it has to capture on the the \{@.[a-zA-Z0-9!\}]\} but that is not correct could some one give me the correct way to match my pattern?

I'm using http://www.regextester.com/ to test the RegEx Matches

Upvotes: 0

Views: 74

Answers (1)

Tiksi
Tiksi

Reputation: 471

I'm a bit confused about what you are asking for here. if it's just a way to match the value within the backticks, will this do the trick for you?

\{@[a-zA-Z0-9\[\]]+\}

This matches the literal "{@" followed by 1 or more of the following characters "a-zA-Z0-9[]" and endind with the literal "}"

Upvotes: 1

Related Questions