CodePudding user response:
Only simple with the help of you, can't match with parentheses inside brackets
Public static ListThe RegexMatch (string input, char cStart, char cEnd, bool isHave)
{
MatchCollection MatchCollection=Regex Matches (input, the string. Format (@ \ {0} "(. *?) The \ {1} ", cStart, cEnd));
ListListResult=new List (a);
Foreach (var v in matchCollection)
{
String strV=v.T oString ();
if (! IsHave)
{
StrV=strV. Trim (new char [] {cStart, cEnd});
}
ListResult. Add (strV);
}
Return listResult;
}