Regular expression to match any chemical element

The Endeavour 2016-02-04

Summary:

Here’s a frivolous exercise in regular expressions: Write a regex to match any chemical element symbol. Here’s one solution. A[cglmrstu]|B[aehikr]?|C[adeflmnorsu]?|D[bsy]|E[rsu]|F[elmr]?|G[ade]|H[efgos]?|I[nr]?|Kr?|L[airuv]|M[dgnot]|N[abdeiop]?|Os?|P[abdmortu]?|R[abefghnu]|S[bcegimnr]?|T[abcehilm]|U(u[opst])?|V|W|Xe|Yb?|Z[nr] Making it more readable Here’s the same expression in more readable form: / A[cglmrstu] | B[aehikr]? | C[adeflmnorsu]? | D[bsy] | E[rsu] | F[elmr]? | G[ade] | H[efgos]? | I[nr]? | Kr? | L[airuv] | […]

Link:

http://feedproxy.google.com/~r/TheEndeavour/~3/laDetBVnUvA/

From feeds:

Statistics and Visualization » The Endeavour

Tags:

computing

Authors:

John

Date tagged:

02/04/2016, 14:33

Date published:

02/04/2016, 09:26