Reputation: 707
I have string like this
abc{[data1]}efg{[data2]}
I need a regex that returns data1
and data2
.
I tried Regex(@"{[\w*]}")
but no hope.
Upvotes: 0
Views: 61
Reputation: 627536
You need to escape the special regex characters, otherwise [\w*]
is treated as 1 word character or an asterisk:
@"\{\[\w*\]}"
^ ^ ^
See demo
Upvotes: 1