fixes #346: validate strings passed to the RegExp constructor
Merge pull request #428 from michaelficarra/GH-346

fixes #346: validate strings passed to the RegExp constructor