Regular Expressions 101

Community Patterns

Equality Expression Supporting Signed Numbers and Decimal

0

Regular Expression
PCRE (PHP <7.3)

/
^(?<Symbol>[=<>!]{0,2})(?<Number>[\-+]?\d+[\.]\d+|[\-+]?\d+)$
/
gm

Description

Finds the components of an equality expression, expecting =,<=,<,>,>=,!= followed by an optionally signed number where the number can be an integer or a decimal (not considered a match if multiple decimals are found)

Submitted by anonymous - 5 years ago