I need to extract from a string a set of characters which are included between two delimiters, without returning the delimiters themselves.
A simple example should b
Here is how I got without '[' and ']' in C#:
var text = "This is a test string [more or less]";
//Getting only string between '[' and ']'
Regex regex = new Regex(@"\[(.+?)\]");
var matchGroups = regex.Matches(text);
for (int i = 0; i < matchGroups.Count; i++)
{
Console.WriteLine(matchGroups[i].Groups[1]);
}
The output is:
more or less