RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pakistan CNIC
Expression
^[1-4]{1}[0-9]{4}(-)?[0-9]{7}(-)?[0-9]{1}$
Description
This expression is used to validate CNIC numbers. The number must start with either 1,2,3 or 4 which represent the province. The hyphen is optional. But if given must be at the correct index (i.e. first one after 5 numbers and second one before the last number). The total length of numbers is 13.
Matches
42222-1010101-1, 11111-1111111-1, 1111111111111, 11111-11111111
Non-Matches
12345678901, 9191-9393939-31
Author Rating: Not yet rated. Noman Aftab
Source
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: overseas nic
Name: humi
Date: 7/16/2013 3:32:53 AM
Comment:
how to check overseas


Title: overseas nic
Name: humi
Date: 7/16/2013 3:32:43 AM
Comment:
how to check overseas


Title: Regular expression for pakistani CNIC
Name: Zaigham Sarfaraz
Date: 10/4/2012 1:37:09 AM
Comment:
how about simply ^\d{5}-\d{7}-\d{1}$


Title: Regular expression for pakistani CNIC
Name: Zaigham Sarfaraz
Date: 10/4/2012 1:03:20 AM
Comment:
how about simply ^\d{5}-\d{7}-\d{1}$


Title: Regular expression for pakistani CNIC
Name: Zaigham Sarfaraz
Date: 10/4/2012 1:02:28 AM
Comment:
how about simply ^\d{5}-\d{7}-\d{1}$


Copyright © 2001-2025, RegexAdvice.com | ASP.NET Tutorials