Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^[-]?[0-9](\.[0-9]+)?$
/
gm

Description

By using this regex, we can check roundup values which is used in billing. Valid results are:

  1. -0.15
  2. 1.11
  3. 9.99

In Valid results are:

  1. All Values > 9.99
  2. All Values < -9.99
Submitted by anonymous - 4 years ago