I have no answer actually but the same problem. I want to pass a string coming from an html form through a perl script to prolog for parsing, but when single quotes are met the processing is stopped. An expression like "John's hat" cannot be processed.
Simple substitutions like the one above do not work as expected. In fact the above regex makes the script non functioning and an error message pops up saying "Form contains no data". There must be a way but certainly not a very much obvious, since I have tried already several tricks and combinations to achieve it.
Temporarily I replace single quotes with backticks. But this does not cover all possible cases for natural language processing. The question of eubios remains open.
Originally posted as a Categorized Answer.