Addressing issue #203

the regex was resulting in undefined, this checks if undefined, and
if so then just return harmless empty string rather than trying to
invoke string methods on undefined.
Merge pull request #208 from dperrymorrow/master

addresses issue #203