public bool IsMatch(string name, uint token) { if (TokensFilter.HasTokens || NameFilter.HasFilters) { bool match = (TokensFilter.HasTokens && TokensFilter.IsMatch(token)) || (NameFilter.HasFilters && NameFilter.IsMatch(name)); if (!match) { return(false); } } if (ExcludeTokensFilter.HasTokens || ExcludeNameFilter.HasFilters) { bool match = (ExcludeTokensFilter.HasTokens && ExcludeTokensFilter.IsMatch(token)) || (ExcludeNameFilter.HasFilters && ExcludeNameFilter.IsMatch(name)); if (match) { return(false); } } return(true); }
public bool IsMatch(string name, uint token) { if (TokensFilter.HasTokens || NameFilter.HasFilters) { bool match = (TokensFilter.HasTokens && TokensFilter.IsMatch(token)) || (NameFilter.HasFilters && NameFilter.IsMatch(name)); if (!match) { return(false); } } if (IgnoreTokensFilter.HasTokens || IgnoreNameFilter.HasFilters) { bool match = !((IgnoreTokensFilter.HasTokens && IgnoreTokensFilter.IsMatch(token)) || (IgnoreNameFilter.HasFilters || IgnoreNameFilter.IsMatch(name))); if (!match) { return(false); } } return(true); }
public void NoMatches(string expressionToMatch) { string someExpression = "A*b+"; RegexFilter filter = new RegexFilter(new Regex(someExpression)); Assert.AreEqual(filter.ToString(), "Regex('" + someExpression + "', None)"); Assert.IsFalse(filter.IsMatch(expressionToMatch)); }
public void Matches(string expressionToMatch, RegexOptions regexOptions) { string someExpression = "A*b+"; RegexFilter filter = new RegexFilter(new Regex(someExpression, regexOptions)); Assert.AreEqual(filter.ToString(), "Regex('" + someExpression + "', " + regexOptions + ")"); Assert.IsTrue(filter.IsMatch(expressionToMatch)); }
public void UnnamedGroup() { var environment = new Environment(); var filter = new RegexFilter(@"^file(\d+)\.txt$"); var file = new DummyFile("file456.txt"); filter.IsMatch(file, environment); Assert.AreEqual("456", environment.Get("1")); }