I am trying to find the correct regular expression syntax for matching and parsing a word surrounded by double brackets.
const string originalString = "I love to [[verb]] while I [[verb]].";
I tried
var arrayOfStrings = Regex.Split(originalString,@"\[\[(.+)\]\]");
But that did not work. I do not know what I am doing wrong.
I would like arrayOfStrings to look like this:
arrayOfStrings[0] = "I love to "
arrayOfStrings[1] = "[[verb]]"
arrayOfStrings[2] = " while I "
arrayOfStrings[3] = "[[verb]]"
arrayOfStrings[4] = "."
source
share