Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
ECMAScript (JavaScript)

/
^[ \t]*([0]|([-+]?(\d*\.)?\d+)(cm|mm|in|px|pt|pc|Q|em|ex|ch|rem|vw|vh|vmin|vmax|%)){1}([\t ]+([0]|([-+]?(\d*\.)?\d+)(cm|mm|in|px|pt|pc|Q|em|ex|ch|rem|vw|vh|vmin|vmax|%))){0,3}[\t ]*$
/
gm

Description

Matches upto 4 length values for CSS properties like border-width.

Submitted by DelD - 3 years ago (Last modified 3 years ago)