I have a string out of which I want to extract a list of strings that are contained between two strings: ['
and ']
. I tried several regex rules (this question in particular) that I found online but the problem is in escaping the characters correctly to make the regex work.
How can I extract a list of strings between two strings? I want to do something like this:
List<string> TheListOfStrings = Regex.Matches(TheText, "....");
The source is a JavaScript block from which I want to extract object keys: for instrance,TheObject['SomeProp'] = TheOtherObject['OtherProp']
and so the list should contain SomeProp
and OtherProp
; the keys can be present multiple times in the input text.