NOS.Registration.PageFormatter.AssertMatchesOnce C# (CSharp) Method

AssertMatchesOnce() private method

private AssertMatchesOnce ( string content, Regex matcher, string matchType ) : int
content string
matcher System.Text.RegularExpressions.Regex
matchType string
return int
		int AssertMatchesOnce(string content, Regex matcher, string matchType)
		{
			MatchCollection matches = matcher.Matches(content);
			if (matches.Count == 0)
			{
				_logger.Error(String.Format("The {0} cannot be found: {1}", matchType, matcher), "SYSTEM");
				return -1;
			}

			if (matches.Count > 1)
			{
				_logger.Error(String.Format("The {0} was found {1} times: {2}", matchType, matches.Count, matcher),
				              "SYSTEM");
				return -1;
			}

			return matches[0].Captures[0].Index;
		}