Avatar of 97WideGlide
97WideGlide
 asked on

c# regex Match variable number of strings

Hi,
The following regex code will match two strings which fall in between ">" and "<":
--------
string rawReview = "aaaaaaaa>string1<bbbbbbb>string2<cccccccc";
           
match = Regex.Match(rawReview, @">([^<]*).*?>([^<]*)");
if (match.Success)
{
    Console.Write("Match found  {0} {1}\n", match.Groups[1], match.Groups[2]);
}
--------
Match found string1 string2

I would like to extend this example to be able to match an arbitrary number of strings which fall between the bracket chars.  Is this possible?  

Thank you very much for reading and considering my question.
AlgorithmsProgramming Languages-OtherProgramming Theory

Avatar of undefined
Last Comment
97WideGlide

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Robert Schutt

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
97WideGlide

ASKER
Simple when you know what you're doing.  I solved it last night after two hours using a MatchCollection which clearly wasn't necessary.  Your solution taught me a bit about regular expressions.

Thank you very much.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy