Title |
Test
Find
Pattern Title
|
Expression |
^\d{2,6}-\d{2}-\d$ |
Description |
Chemical Abstract Service Registry Number (CAS Nr). Identify chemical substance or mixture.
(http://www.cas.org/New1/casinfo.html) |
Matches |
50-00-0 | 862771-58-2 |
Non-Matches |
50-000-0 | 50-00-00 | 5-00-00 |
Author |
Rating:
Not yet rated.
Pavel Piskac
|
Source |
|
Your Rating |
|
Title: Update
Name: Joe
Date: 5/11/2009 11:24:27 AM
Comment:
Needs updating to be ^\d{2,7}-\d{2}-\d$ as the first part can now be up to seven digits. Good starting point for a routine which includes validation of the final checksum digit.
Title: only format checking
Name: polo
Date: 8/16/2007 10:24:51 AM
Comment:
Hi all this regex does NOT check if it is a valid CAS, only if the Format right. The r isn't checked
ni ... n4 n3-n2 n1-R because r is sum(ni * i) mod 10