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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Medicare HIC Number (HICN)
Expression
^(00[1-9]|0[1-9][0-9]|[1-7][0-9][0-9]|7[0-7][0-2]|77[0-2])(\d{6})(A|B([1-9]?|[ADGHJKLNPQRTWY])|C([1-9]|[A-Z])|D([1-9]?|[ACDGHJKLMNPQRSTVWXYZ])|E([1-9]?|[ABCDFGHJKM])|F([1-8])|J([1-4])|K([1-9]|[ABCDEFGHJLM])|T([ABCDEFGHJKLMNPQRSTUVWXYZ2]?)|M|W([1-9]?|[BCFGJRT]))$
Description
This is the real regex for a non-railroad board HICN. All combinations are accounted for. This does not account for dashes as they are stripped out before I do the validation. This also only allows 001-772 as the first 3 numbers per spec. It does not take into consideration that 00 is not allowed for 4th and 5th digits and that 0000 is not allowed for last 4 digits.
Matches
123456789F1 123456789W
Non-Matches
1234567890 A000000 WCD000000 123-45-6789A
Author Rating: The rating for this expression. Derek
Source CMS and me
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: Didn't account for T3-9.
Name: Adam Walter
Date: 2/22/2021 7:23:34 PM
Comment:
Hi Derek, The T part of this regex doesn't account for T3-9. So it should be T([ABCDEFGHJKLMNPQRSTUVWXYZ2-9]?). Source here: https://www.grotenhuisguide.com/A55956/grotenhuis.nsf/f9d12e89344f312585256d8e0068128f/2fb304c58af3e6cd85257bf10054aaf3/$FILE/HICNsuffixesprefixesfinal.pdf Have a great day, Adam


Title: Didn't account for T3-9.
Name: Adam Walter
Date: 2/22/2021 7:10:28 PM
Comment:
Hi Derek, The T part of this regex doesn't account for T3-9. So it should be T([ABCDEFGHJKLMNPQRSTUVWXYZ2-9]?). Source here: https://www.grotenhuisguide.com/A55956/grotenhuis.nsf/f9d12e89344f312585256d8e0068128f/2fb304c58af3e6cd85257bf10054aaf3/$FILE/HICNsuffixesprefixesfinal.pdf Have a great day, Adam


Title: Didn't account for T3-9.
Name: Adam Walter
Date: 2/22/2021 6:54:16 PM
Comment:
Hi Derek, The T part of this regex doesn't account for T3-9. So it should be T([ABCDEFGHJKLMNPQRSTUVWXYZ2-9]?). Source here: https://www.grotenhuisguide.com/A55956/grotenhuis.nsf/f9d12e89344f312585256d8e0068128f/2fb304c58af3e6cd85257bf10054aaf3/$FILE/HICNsuffixesprefixesfinal.pdf Have a great day, Adam


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