Escape special characters before embedding them in a regular expression.

Fixes #279