c# - Regular expression to retrieve text from a string -


i have string have values like

{ctrl1} + {ctrl2} ({ctrl1} / {ctrl2}) * {ctrl3} if ({ctrl1} > {ctrl2}) {ctrl1} * 10 else {ctrl} + {ctrl2} endif 

there several formulas this. available in string variable. need extract {..} values.

so, in example1, should extract {ctrl1}, {ctrl2}. in example2, should extract {ctrl1}, {ctrl2}, {ctrl3}. in example3, should extract {ctrl1}, {ctrl2}.

can please me regex this?

you want {[^}]+}.

note that won't handle recursive stuff {hello{2}}. you'll need actual parser things that.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -