You can do this with a regular expression such as (:)|"[^"\r\n]*"
that matches either a colon, or a string. Use a capturing group to determine whether the colon was matched or not. Iterate over the matches of this regex to process the colons.
Regex regexObj = new Regex("(:)|\"[^\"\r\n]*\"");
Match matchResults = regexObj.Match(subjectString);
while (matchResults.Success) {
if (matchResult.Groups[1].Success) {
// Colon was matched
}
matchResults = matchResults.NextMatch();
}
Note that while this regex works correctly on your code sample, it won't work on C# code in general. The regex doesn't handle strings that contain escaped quotes, doesn't handle verbatim strings, and doesn't exclude colons from comments. If you want all that you'll need to expand the regex using the same principle, e.g:
(:)|string|verbatim string|single line comment|multi line comment