As in code

$query = preg_replace('![^\w\d\-\]*!', '', $query); 

set the character '/' so that it also recognizes and reads it? For example, I need the value of $ query = 'WT / KSK.80 / 1' to keep their slashes after processing, now they disappear

  • I certainly could be wrong, but it seems you have an extra backslash. $query = preg_replace('![^\/\w\d\-]*!', '', $query); - Bogdan Gudyma
  • What result do you want to get? - Naumov

1 answer 1

Try

 $query = preg_replace('![^\/\w\d\-\]*!', '', $query); 
  • a little bit wrong. For example, I need the value $ query = 'WT / KSK.80 / 1' to keep their slashes after processing, now they disappear - Roma Tulaydan
  • Well, preg_replace replaces all the characters in the regulars, with an empty space. Use then preg_match. - MyZik