I know the question sound’s a bit weird. Let me explain the situation:
I have an undefined text that looks like this:
Lorem {placeholder1} ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. {placeholder2} Cum sociis natoque penatibus et magnis dis parturient montes, {placeholder3} nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo
As you may notice, there are some placeholders inside the text: {PlaceholderX}. The only thing I know is that a placeholder is surrounded by {}. I dont know what’s between them.
Now i’m looking for the best way to get a list of all strings surrounded by {} out of my text.
Or, to make it more general, is there a method where I can provide some kind of pattern like {*} and get back all fitting words as strings?
You are looking for regular expressions, in this case you need to make use of lookarounds
The .* means it will find any non-space character between the braces
Here is a C# tutorial on how this can be used
Here is an example that shows how to pull out each item
I have adapted it for your example