Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
Created·2020-07-09 07:44
Flavor·PCRE (Legacy)

/
^ [ \t]* (?: (?<style> dashed|dotted|double|groove| hidden|(?:in|out)set|inherit| initial|none|ridge|solid ) (?:[ \t]+|[ \t]*(?=$)) ){0,4} [ \t]*$
/
iJxXmg
Open regex in editor

Description

Validates any border-style value that contains 0-4 (valid) border styles.

Only restriction on whitespace is at least one space/tab between values—all of the examples below are valid:

"solid"
"solid none"
"none none solid"
"outset inset inset solid"
"solid none none"
"solid"
"solid"
"none solid"
"inset             outset   none"
"inset inset outset          none"
Submitted by anonymous