[Solved] How take the string between two symbols c#? [closed]


I’m not sure if this matches what you need but you could try:

var myString = "!re=.id=2CB=name=xxname123=service=vpn=caller-id=";
var match = new Regex(@"\.id=(?<value>[^=]*)=").Match(myString);
var id = match.Groups["value"].Value;

I haven’t tested this for specific syntax, but that should get you just that captured string. You can modify that to iterate across a MatchCollection if you need to do it across a number of items.

foreach(var match in new Regex(@"\.id=(?<value>[^=]*)=").Matches(myString) 
{
    var id = match.Groups["value"].Value; //Or do something else with the value
}

1

solved How take the string between two symbols c#? [closed]