Community Patterns

Community Library Entry

0

Regular Expression
Created·2017-04-11 18:52
Flavor·Python

r"
(?:[\(\)eA-Z][a-z]*(?:_\{? ?\d*\}?(?:(?:_\d)?)*)?)+(?:\^\{? ?\d*[\+-]?\}?)?
"
g
Open regex in editor

Description

Matches chemical formula written with latex, ex: H_2O, C_5H_12, Pb(NO_3)_2

Submitted by Jingjie Yang