I have a string that looks like this
../Clean_Smarty_Projekt/tpl/templates_c\\.
../Clean_Smarty_Projekt/tpl/templates_c\\..
I want to replace <
I suggest you to use a different php delimiter. Within the /
delimiter, you need to use three \\\
or four \\\\
backslashes to match a single backslash.
$string = '../Clean_Smarty_Projekt/tpl/templates_c\.'."\n".'../Clean_Smarty_Projekt/tpl/templates_c\..';
echo preg_replace('~\.\./|\\\.{1,2}~', '', $string)
Output:
Clean_Smarty_Projekt/tpl/templates_c
Clean_Smarty_Projekt/tpl/templates_c