Validate Alphabetic Character Script

Validate Alphabetic Character Script is use to validate alphabetic character through regular expression.

Demo :



Alphabetic Character :  

Example :

Just type a alphabetic character like this AB and click Check button Is alphabetic message will display otherwise type a AB2 text at textbox and click check button Is not alphabetic message will display here.

Code :

Following code is use to Validate Alphabetic String Script if you need to copy and use to your website.


<?php
  function validateAlpha($str)
  {
    return preg_match("/^[a-z]+$/i", $str);
  }
  $alphabetic = "Abc";
  echo validateAlpha($alphabetic) ? "Is alphabetic" : "Is not alphabetic";
?>

In the above $alphabetic variable is use to assign the alphabetic character. In the validateAlpha() function is use to check the alphabetic character through regular expression.

Free Download Script :

If you need Validate Alphabetic Character Script click and download from following link.

Download




Content