Link to home
Start Free TrialLog in
Avatar of catonthecouchproductions
catonthecouchproductionsFlag for United States of America

asked on

IRS Number

I have been trying to get a regex to validate for IRS # and also the alternative format where it has the "-AA" at the end for subsets of a company.

Any ideas?

Thx
Avatar of numberkruncher
numberkruncher
Flag of United Kingdom of Great Britain and Northern Ireland image

IRS REGEX FROM: http://regexlib.com/UserPatterns.aspx?authorid=fd2705c4-5998-4154-9d4e-a5996cdcebe1

^([07][1-7]|1[0-6]|2[0-7]|[35][0-9]|[468][0-8]|9[0-589])-?\d{7}$

Open in new window


Adding two optional characters at end:

^([07][1-7]|1[0-6]|2[0-7]|[35][0-9]|[468][0-8]|9[0-589])-?\d{7}(-[A-Za-z]{2})$

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of numberkruncher
numberkruncher
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of catonthecouchproductions

ASKER

Perfect!