Community Patterns

Community Library Entry

0

Regular Expression
Created·2023-02-14 03:58
Flavor·PCRE2 (PHP)

/
\-?\d*\.?\d+[\+\-÷%x]\-?\d*\.?\d+
/
g
Open regex in editor

Description

Matches operations with two numbers separated by the operational characters (x, -, ÷, %) ** the numbers can be negative** (can contain a - character before the number).

It also acepts decimal notation with not zero (0). Example: 0.89 and .89 are both accepted values

Acepted values example:

  • -3x+5.0
  • 784.5-.56
  • 1÷.5
Submitted by anonymous