I need string with brackes from one string using regex. My string will be like: Node{id}data_{name}key
So I need id and name with comma seperated Result: id, name.
Can I have regex expression for the same?
How about
Node{+(?<id>[0-9]*)+}data_{+(?<name>[a-zA-Z]*)}key
You tagged with C# so how about code something like the following (not tested)
Regex exp = new Regex(@"Node{+(?<id>[0-9]*)+}data_{+(?<name>[a-zA-Z]*)}key", RegexOptions.IgnoreCase);
MatchCollection matchList = exp.Matches(yourString);
string id = matchList.Groups["id"].Value;
string name = matchList.Groups["name"].Value;
//build up whatever string you like
return String.Format("{0},{1}", id, name);