On Wed, Aug 10, 2016 at 12:44 AM, Bináris wikiposta@gmail.com wrote:
Hi, does anyone have a good regex for chemical formulae?
These samples below were found with \d,\d,\d\S+-\d-\S+ which seems pretty good in not matching falses (every match is OK), but I don't know how many matches are left out. Do you know a better one without false positives?
Does this one suit your purposes:
([αβγδφωλμπ]-)?([([]*[A-Z☐][ub]?[a-z]?[₁₂₃₄₅₆₇₈₉₀]*()?[¹²³⁴⁵⁶⁷⁸⁹⁰]*[⁺⁻]?)?[])|,₁₂₃₄₅₆₇₈₉₀]*(·(?[-0-9.]*n?)?)?)+
https://www.wikidata.org/wiki/Property:P274
-- John