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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

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
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: 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


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