Regular Expressions 101

Community Patterns

Match length values for CSS properties like border-width upto 4 allowed values

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 - 2 years ago (Last modified 2 years ago)