Pattern Matching on Weighted Strings