pmatchSafe function

Partial matching of strings with error checking