In this paper, the authors propose a general framework for matching similar subsequences in both time series and string databases. The matching results are pairs of query subsequences and database subsequences. The framework finds all possible pairs of similar subsequences if the distance measure satisfies the "Consistency" property, which is a property introduced in this paper. They show that most popular distance functions, such as the Euclidean distance, DTW, ERP, the Frechet distance for time series, and the Hamming distance and Levenshtein distance for strings, are all "Consistent". They also propose a generic index structure for metric spaces named "Reference net".