<?php $re = '/\\\\(\\\\)|\\\\./s';$str = 'ab\\xy ab\\\\xy ab\\\\\\xy';echo $result = preg_replace($re, '$1', $str);
Standard input is empty
aby ab\xy ab\y
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!