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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Employer ID Number
Expression
^([07][1-7]|1[0-6]|2[0-7]|[35][0-9]|[468][0-8]|9[0-589])-?\d{7}$
Description
US IRS Employee ID Number, aka Federal Tax ID Number
Matches
01-1234567, 011234567
Non-Matches
00-1234567, 49-1234567, 123-45-6789
Author Rating: The rating for this expression. Brad Williams
Source http://en.wikipedia.org/wiki/Employer_Identification_Number
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: Fixed
Name: Homesar
Date: 1/10/2014 12:26:36 PM
Comment:
^(0[1-6]|1[0-6]|2[0-7]|[35][0-9]|[468][0-8]|9[0-5|8-9]|7[1-7])-?\d{7}$ This covers all of the campus codes. Both the original and molaro's had a few errors, like allowing 07-1234567


Title: Re: A Few Questions
Name: molaro
Date: 8/18/2011 10:58:36 AM
Comment:
I sorted the campus codes from the EIN page on the US gov's site (see below), and based on that, it seems like this RegEx should be this instead: ^([01][0-6]|2[0-7]|[35][0-9]|[468][0-8]|7[1-7]|9[0-9])-?\d{7}$ Am I just missing something? Sorted Campus Codes (sources: http://anse.rs/pi4dAB AND http://1.usa.gov/l2sEjX) : 01,02,03,04,05,06,10,11,12,13,14,15,16,20,21,22,23,24,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,71,72,73,74,75,76,77,80,81,82,83,84,85,86,87,88,90,91,92,93,94,95,98,99


Title: A Few Questions
Name: molaro
Date: 8/17/2011 4:43:08 PM
Comment:
Thx for posting this regex pattern. After looking through it and comparing the first section to the list of possible campus codes, I have 2 questions. 1 - seems that "[07][1-7]" is incorrect for zero. I only see 01-06 in the list. & does go from 70-77 so it is good. Am I misunderstanding something? 2 - Not sure I understand the 9 section at all. I see codes for 90-99, but your script has 90-589. Where is the 589 coming from? Thx in advance!


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