Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
ECMAScript (JavaScript)

/
^(?:[$]|)[+-]?[0-9]{1,3}(?:[0-9]*(?:[.,][0-9]{2})?|(?:,[0-9]{3})*(?:\.[0-9]{1,2})?)$
/
gm

Description

Allows Number: Currency amount US (cents optional) Can use US-style 123,456.78 notation Optional thousands separators; optional two-digit fraction; commas; dollar sign

Submitted by NatZol - 3 years ago