Ravi,
In addition to the other comments.
You could use a While loop with Match.NextMatch.
Something like:
string pattern = @"(?<key>\w+)=(?<value>\w+)(:;|)";
string input = "a=1;b=2;c=3;d=4;e=5;";
Regex parser = new Regex(pattern, RegexOptions.Compiled);
Match match = parser.Match(input);
while (match.Success)
{
Debug.WriteLine(match.Groups["key"], "key");
Debug.WriteLine(match.Groups["value"], "value");
match = match.NextMatch();
}
Where "=" is Delim1 & ";" is Delim2, depending on how important Delim3 is I
would consider using String.SubString to extract the input upto Delim3 then
use the above code...
Hope this helps
Jay
"Ravi Singh (UCSD)" <ra*********@gmail.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com...
Hello all
I have a huge string that I need to parse
Key <Delim1> Value <Delim2> Key <Delim1> Value <Delim2> Key <Delim1>
Value <Delim3>
Key <Delim1> Value <Delim2> Key <Delim1> Value <Delim2> Key <Delim1>
Value <Delim3>
repeat for a couple hundred thousand times
The <Delim1> seprates the Key, Value pair
<Delim2> seprates two different Key,Value pairs
<Delim2> seprates records.
I need to get the Key Value pairs and populate a table with that
information.
Would the .NET regular expressions be worth while and how would I go
about doing it in a clean optimized fashion.
Thanks
-Ravi Singh