title: PHP : Japanese character validation : Why Hiragana characters validated against regular expression of Katakana characters?
body: <p>I want to validate whether user's input is in <strong>Full width Katakana</strong> characters or not ?</p>
  
  <p>Here is a set of japanese characters according to categories</p>
  
  <p><a href="http://www.rikai.com/library/kanjitables/kanji_codes.unicode.shtml" rel="nofollow">http://www.rikai.com/library/kanjitables/kanji_codes.unicode.shtml</a></p>
  
  <p>Now look at below code, I am trying to validate, different inputs</p>
  
  <p><code>$pattern</code> contains all full width katakana characters</p>
  
  <pre><code>header('Content-Type: text/html; charset=utf-8');
          $pattern = "/^([゠ァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロヮワヰヱヲンヴヵヶヷヸヹヺ・ーヽヾヿ]+)$/";
          $values = array("ナカ" , 
                          "ね",
                          "PHP",
                          "ナカPHP",
                         );
  
          foreach ($values as $value){
              echo $value. "  =&gt;  ";
              if(preg_match($pattern, $value)){
                  echo "valid";
              }else{
                  echo "invalid";
              }
              echo "&lt;br&gt;";
          }
  </code></pre>
  
  <p>1st value in <code>$values</code> array is valid full width katakana, 2nd is Hiragana, and 3rd and 4th are invalid entries.</p>
  
  <p>I am getting following output.</p>
  
  <pre><code>ナカ =&gt; valid
  ね =&gt; valid
  PHP =&gt; invalid
  ナカPHP =&gt; invalid
  </code></pre>
  
  <p>Concern is why Hiragana characters validated, this issue exists against many Hiragana characters while need is only <strong>Full width KataKana</strong></p>
  
  <p>Thanks in Advance.</p>