Here is my regex to exclude special character other then allowing few like (-,%,:,@). I want to allow / also but getting issue
return preg_replace('/[^a-zA-Z0-9_ %\[\]\.\(\)%:@&-]/s', '', $string);
this works fine for listed special character, but
return preg_replace('/[^a-zA-Z0-9_ %\[\]\.\(\)%\\:&-]/s', '', $string);
does not filter l chracter to.
Here is the link to test:
where it does not allow \\ in url. I want to dispaly URL as usual