Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi everybody! I want to read variables names from a given string with regex.

For example,

C#
Hi {$name}, you have {$days} days left.


The string is shown to user in a textbox so that he will know where values will be inserted after giving command for execution. How do I extract the variables names: (name, days) from the string using regex or any other method? I'm programming in C#.

Thanks in advance.
Posted
Updated 5-Nov-14 7:26am
v2

1 solution

How about : (?'parm'\{[^}]+\})
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900