10
2
Find the shortest regex that matches all radioactive elements and nothing else in the Periodic Table of Elements.
Radioactive Elements
'Technetium','Promethium','Polonium','Astatine','Radon','Francium','Radium','Actinium','Thorium','Protactinium','Uranium','Neptunium','Plutonium','Americium','Curium','Berkelium','Californium','Einsteinium','Fermium','Mendelevium','Nobelium','Lawrencium','Rutherfordium','Dubnium','Seaborgium','Bohrium','Hassium','Meitnerium','Darmstadtium','Roentgenium','Copernicium','Ununtrium','Flerovium','Ununpentium','Livermorium','Ununseptium','Ununoctium'
Non-radioactive Elements
'Hydrogen','Helium','Lithium','Beryllium','Boron','Carbon','Nitrogen','Oxygen','Fluorine','Neon','Sodium','Magnesium','Aluminium','Silicon','Phosphorus','Sulphur','Chlorine','Argon','Potassium','Calcium','Scandium','Titanium','Vanadium','Chromium','Manganese','Iron','Cobalt','Nickel','Copper','Zinc','Gallium','Germanium','Arsenic','Selenium','Bromine','Krypton','Rubidium','Strontium','Yttrium','Zirconium','Niobium','Molybdenum','Ruthenium','Rhodium','Palladium','Silver','Cadmium','Indium','Tin','Antimony','Tellurium','Iodine','Xenon','Caesium','Barium','Lanthanum','Cerium','Praseodymium','Neodymium','Samarium','Europium','Gadolinium','Terbium','Dysprosium','Holmium','Erbium','Thulium','Ytterbium','Lutetium','Hafnium','Tantalum','Tungsten','Rhenium','Osmium','Iridium','Platinum','Gold','Mercury','Thallium','Lead','Bismuth'
- Scored by character count in the regex.
- Use standard Perl regex (just no specialized functions).
- Assume all lower case.
- You only need to count the characters of the regex itself.
Note if you used a program to get you started and maybe post how well it did. I'll post my best attempt as an answer to get started/show an example.
@qw3n You could say “regular expression describing a regular language” to exclude all the language specific things. – FUZxxl – 2015-03-08T11:58:53.840
Can you quote a regex standard, such as POSIX regular, POSIX extended, PCRE…? Otherwise "language agnostic" doesn't really mean much. – Tobia – 2014-01-08T21:55:29.727
Sorry, I have only had to use regex in java and javascript and don't really know all the differences. The goal is to create a regex that would work in most common languages without relying on language specific feature. – qw3n – 2014-01-08T22:02:06.473
There is an ongoing discussion as to whether we want regex golf on this site. Please contribute.
– Peter Taylor – 2014-01-08T23:48:09.913