Regular Expressions 101

price float pattern

Open Workspace
  • JavaScript
  • Unit Tests
2

Regular Expression

/
^\d+(?:[.]\d{1,2}|$)$
/

Description

Checks that value is float format and has two digits at max

Submitted by @jprajani