Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Community Library
How to contribute
x
Latex Chemical formula
Open Workspace
Python
Match
Created 2017-04-11 18:52
0
Regular Expression
r"
(?:
[
\(\)
eA
-
Z
]
[
a
-
z
]
*
(?:
_
\{
?
?
\d
*
\}
?
(?:
(?:
_
\d
)?
)*
)?
)+(?:
\^\{
?
?
\d
*
[
\+
-
]
?
\}
?
)?
"
g
Description
Matches chemical formula written with
latex
, ex:
H_2O
,
C_5H_12
,
Pb(NO_3)_2
Submitted by
Jingjie Yang