String matching is a useful concept in pattern recognition that is constantly receiving attention from both theoretical and practical points of view. In this paper we propose a generalized version of the string matching algorithm by Wagner and Fischer . It is based on a parametrization of the edit cost. We assume constant cost for any delete and insert operation, but the cost for replacing a symbol is given as a parameter r. For any two given strings A and B, our algorithm computes the edit distance of A and B in terms of the parameter r. We give the new algorithm and study some of its properties. Its time complexity is O(n2-m), where n and m are the lengths of the two strings to be compared and n ≤ m. We also discuss potential applications of the new string distance to pattern recognition. Finally, we present some experimental results.