> Are you trying to match any to any strings? or only a pair as above? > Just a pair at a time, and I only want the first N characters that are common to both strings. The os.path.commonprefix works nicely. Thanks for your help. Ravi