I have the line "h///e/ll\\o\//\" . You need to remove all slashes from it back and forth slashes several times, can anyone show me a regex to do this?
"h///e/ll\\o\//\"
its for php preg_replace ();
Try the following:
var_dump(preg_replace("@[/\\\]@", "", "h///e/ll\\o\\//\\")); // Output: string(5) "hello"
http://codepad.org/PIjKsc9F
Or alternatively
var_dump(str_replace(array('\\', '/'), '', 'h///e/ll\\o\\//\\')); // Output: string(5) "hello"
http://codepad.org/0d5j9Mmm
You do not need regex to remove them:
$string = str_replace(array('/', '\\'), '', $string);
Source: https://habr.com/ru/post/1396529/More articles:Ignore parent class when serializing in XML - javaMSTEST - Continued after confirmation failed - visual-studioDoctrine / MongoDB / Strategy - Updating documents with saving / dumping - mongodbJQuery error for mobile devices in javascript google console - javascriptHow to register SQL using entity framework 4.3 (code first) and Azure SQL database - entity-frameworkInternal memory full of images, probably caused by Bitmap.compress (format, int, stream) - androidHow to "pull the network cable" programmatically in a large Linux application? - c ++How to create a Rails model from a subset of table entries - ruby-on-rails-3Drawing a random nonzero element from a sparse matrix - matlabEfficient data structure with two keys - javaAll Articles