Regular Expressions 101

Community Patterns

Tests string if it is a valid number with or without its unit

0

Regular Expression
ECMAScript (JavaScript)

/
(-?)\d+(\.?(\d+?)?(\w+))?
/
ig

Description

Useful when working with css

Submitted by anonymous - 4 years ago