tags:

views:

23

answers:

1

For example, i have a pattern that i am searching for using the \G option so it remembers its last search. I would like to be able to reuse these in .NET c# (ie: save the matches into a collection)

For Example:

string pattern = @"\G<test:Some\s.*";
string id = RegEx.Match(orig, pattern).Value;  
// The guy above has 3 matches and i want to save all three into a generic list

I hope this is clear, i can elaborate if not.

thanks :-)

+2  A: 

You will need to use the RegEx.Matches function and iterate through the collection.

hova
Thank you very much, i am trying this but with no luck - when i use RegEx.Match(orig, pattern) it works, if i do:MatchCollection co = RegEx.Matches(orig, pattern); I get 0 results. Any idea what im doing wrong here?
schmoopy