title: preg_replace and preg_match arabic characters
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4842378/how-to-add-arabic-letters-to-url-regex">how to add Arabic letters to url regex</a>  </p>
  </blockquote>
  
  
  
  <p>I have been searching a couple of hours without an answer.</p>
  
  <p>How do you use preg_replace on arabic characters as well as english?</p>
  
  <p>this is my code is english</p>
  
  <pre><code>$string = preg_replace ( "/&amp;([a-zA-Z])(uml|acute|grave|circ|tilde|ring),/", "", $string );
  $string = preg_replace ( "/[^a-zA-Z0-9_.-]/", "", $string );
  </code></pre>
  
  <p>some of the answers suggested i use this code:</p>
  
  <pre><code>$string = preg_replace ( "/&amp;([أ-يa-zA-Z])(uml|acute|grave|circ|tilde|ring),/u", "", $string );
  $string = preg_replace ( "/[^أ-يa-zA-Z0-9_.-]/u", "", $string );
  </code></pre>
  
  <p>I have tested it and it works. but is this actually functional for php? does it include all arabic characters? is there a better way to include all arabic characters?</p>
  
  <p>What i am going to do with the code is:</p>
  
  <p>Replace all characters in the string to valid SEO friendly characters.</p>
  
  <p>I solved the problem using this code based on <a href="http://www.unicodemap.org" rel="noreferrer">http://www.unicodemap.org</a>. Thank you Bryan.</p>
  
  <pre><code>$string = preg_replace ( "/&amp;([\x{0600}-\x{06FF}a-zA-Z])(uml|acute|grave|circ|tilde|ring),/u", "", $string );
      $string = preg_replace ( "/[^\x{0600}-\x{06FF}a-zA-Z0-9_.-]/u", "", $string );
  </code></pre>