The MSDN website has a good explanation of the regular expression capabilities in .NET. [^] 99% of what you know will transfer from PHP. The most obvious differences are that you do not start and end the pattern with a delimiter character and that you specify expression options (like the si at the end of your expression) differently. There are also some advanced things you can do with .NET regular expressions, but you probably will not need them here. As for looping through the matches, you will probably use a while loop
using System.Text.RegularExpressions;
string phpFileText = /* load php file*/;
Regex matcher = new Regex(/* your pattern here */,
/* your options here if not in the pattern itself*/);
Match code = matcher.Match(phpFileText);
while (code.Success)
{
/* do stuff here */
code = code.NextMatch();
}
PS: don't forget that ? is a quantifier in regular expressions, so you need to escape them when searching for a literal ?