Fixed #857: Pattern delimiter is not passed to several preg_quote calls
ported f60ae8cd3214005cd3f21be7154d8365f8c16b48 to 891e450e1dc057639dddfaf60fabace2cb7ed06a (from 0.11)