Given a text of size nxn and a pattern of size m x m, the exact-matching is to find all occurrences of the pattern in the text, while the approximate-matching is to find all the locations of mx m blocks in the text that differ by at most k mismatches. We present a new algorithm for exact-matching, which runs in O(n(2) log\Sigma\), Sigma = {a(1), a(2), ..., a(\Sigma\)} is the alphabet of the pattern, and for approximate-matching, in O(n(2) log\Sigma\+hm(2)), which consists of two stages. The first stage is to preselect h subblocks of size s x s, 0 less than or equal to s less than or equal to m that exactly match the pattern. And the second stage of verification compares the blocks containing these h subblocks to determine if the number of mismatches is less than k.