Regular Expressions 101

Community Patterns

Parse all simple math expressions (decimals, whole, negative)

-2

Regular Expression
PCRE (PHP <7.3)

/
([\d]*[.][\d]*)*|[\d]|([\+\-\*\(\)\^\/\ \d])
/
g

Description

-2.02^3(2+3.024)+3.14159-(45^23)/(19-4)

Submitted by anonymous - 8 years ago