diff --git a/trie.go b/trie.go index fe4c517..22593b5 100644 --- a/trie.go +++ b/trie.go @@ -377,6 +377,11 @@ func (s *intMatcher) match(iter *charIter) bool { c, sep, ok := iter.next() count++ + // if it's the end of the string, it's a match + if !ok { + return true + } + // if the current character is not a number: // - it's either a separator that means it's a match // - it's some other character that means it's not a match @@ -391,11 +396,6 @@ func (s *intMatcher) match(iter *charIter) bool { return false } } - - // if it's the end of the string, it's a match - if !ok { - return true - } } } diff --git a/trie_test.go b/trie_test.go index fe7d490..0806494 100644 --- a/trie_test.go +++ b/trie_test.go @@ -233,6 +233,12 @@ func (s *TrieSuite) TestMergeAndMatchCases(c *C) { "http://google.com/v42/domains/domain1", "/v/domains/", }, + // Int matcher at the end of the Trie + { + []string{"/v/domains/"}, + "http://google.com/v42/domains/1", + "/v/domains/", + }, // Int matcher, no match { []string{"/v/domains/", "//domains/"},