EINECS号:EINECS = re.compile(r'^\d\d\d-\d\d\d-\d$')
CAS = re.compile(r'^\d*-\d\d-\d$')
分子式:FORMULA = re.compile(r'([A-Z][A-Za-z0-9]+\.?[A-Za-z0-9]+/?[A-Za-z0-9]+)')
CAS号最后验证码的计算方法:
For example, the CAS number of water is 7732-18-5: the checksum is calculated as (8×1 + 1×2 + 2×3 + 3×4 + 7×5 + 7×6) = 105; 105 mod 10 = 5.
Chemical Elements symbols | |
Expression |
^((?-i)A[cglmrstu]|B[aehikr]?|C[adeflmorsu]?|D[bsy]|E[rsu]|F[emf]?|G[ade]|H[efgos]?|I[nk]?|Kr?|L[airu]|M[dgnot]|N[abdeiop]|Os?|P[abdmortu]?|R[abefghnu]|S[bcegimnr]?|T[abcehil]|U(u[bhopqst])?|V|W|Xe|Yb?|Z[nr])$ |
---|---|
Description |
Chemical elements of the periodic table from 1 to 118. |
Matches |
Hg |
Non-Matches |
HE |
Author | Guy Bruneau |
Title | Test Details CAS Number |
---|---|
Expression |
\b[1-9]{1}[0-9]{1,5}-\d{2}-\d\b |
Description |
This is a more robust regex for matching Chemical Abstract Service (CAS) Numbers. This distinguishes between CAS numbers and other identifiers (e.g. EC number). |
Matches |
50-00-0 |
Non-Matches |
200-001-8 |
Author | Jarlath |
评论