
Regular expression to match a chemical element - kevin
http://www.johndcook.com/blog/2016/02/04/regular-expression-to-match-a-chemical-element/
======
colanderman
How about just /Ac|Ag|Al|Am.../. Let the regex compiler do the work for you,
and keep it readable and maintainable.

(A true regular expression is compiled to a DFA, which is unique for the set
of input strings matched, so there is nothing to gain performance-wise from
factoring out common prefixes. That is quite literally the job of the
compiler.)

