title: Search string in php for characters that are not
body: <p>This is probably very simple, but I couldn't find it.  </p>
  
  <p>I need to search a string for a group of chinese characters, and replace them with an english word.  </p>
  
  <p>So basically search a string for the first character that is not a-z, 1-9 or - , but I couldn't find how. </p>
  
  <p>I'm currently using string pointers at the start and end of the characters to achieve the result, which working is fine, but looking pretty sloppy. </p>
  
  <pre><code>   $str_start = strpos ( $switcher , 'start' );// get the string start
     $str_start +=5;//Add 5 to it to make up for the length of search term
     $str_end = strpos ( $switcher , '/' , $str_start );//find the end
     $length = $str_end - $str_start;//get the length of chinese characters
     echo substr_replace ( $switcher , 'product-category' , $str_start , $length );//replace with english word
  </code></pre>
  
  <p>EDIT: Actual example added for clarity: </p>
  
  <pre><code>&lt;option value="http://imw1248.info/商品分类/bamboo-cutting-board/small-cutting-boards/"&gt;English&lt;/option&gt;
  </code></pre>
  
  <p>Should be: </p>
  
  <pre><code>&lt;option value="http://imw1248.info/product-category/bamboo-cutting-board/small-cutting-boards/"&gt;English&lt;/option&gt;
  </code></pre>
  
  <p>Code: </p>
  
  <pre><code>       $str_start = strpos ( $switcher , '.info/' );
         $str_start +=6;
         $str_end = strpos ( $switcher , '/' , $str_start );
         $length = $str_end - $str_start;//get the length of chinese characters
         echo substr_replace ( $switcher , 'product-category' , $str_start , $length );
  </code></pre>