public int Position = 0; String Token = null; string CurrentString; bool R(string RegEx) { SkipSpacesComments(); Match M = Regex.Match(CurrentString, "^" + RegEx , RegexOptions.IgnoreCase); if (M.Success) { Token = CurrentString.Substring(0, M.Length); Position += M.Length + SpaceLength; } return M.Success; } bool W(string C) { return R(C + "\\b"); // whole words only } bool C(string C) { return R(Regex.Escape(C)); }