Monday, 7 July 2014

Indian Pan card Validation by Regular Expressions

Indian Pan card Validation by Regular Expressions

// Total Length 10 Digit 
// 5 Character value  4 numeric value 1 Character value 
 System.Text.RegularExpressions.Regex rPan = 
      new System.Text.RegularExpressions.Regex 
          (@"^([a-zA-Z]){5}([0-9]){4}([a-zA-Z]){1}?$");
           if (txt_PanNo.Text.Trim().Length > 0)
           {
                if (!rPan.IsMatch(txt_PanNo.Text.Trim()))
                {
                   return true;
                }
                else
                {
                    return false;
                }
           }