What I require is to replace \/:"?<*>| with a space.

I have done similar statements before but I have complete brain freeze at the moment. Hoping one of you can jog my memory. Always hated regex expressions never understood the logic behind them minus the A-Z and 0-9 and then all the brackets, etc. Blah!
Anyways:

$pattern = // This where I require the regex expression
$replacement = " ";
$string = "a\b/c:d*e?f"g<h>i|j";
$test_string = preg_replace($pattern, $replacement, $string);
echo $test_string;

If you want everything accept for letters and numbers you can use

$pattern = '/[^a-z0-9]/i';

If you are specific about \/:"?<*>| then it's this

$pattern = '#[\/:"\?<\*>|]#';
commented: Thanks for the solution. +3

Thanks for the solution.

If you have any good sites to refresh my memory of this stuff let me know.

Thankyou.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.