Regular Expressions 101

Community Patterns

JavaScript Parse CSS Selector

0

Regular Expression
ECMAScript (JavaScript)

/
^(.*?)(?:#(.*?))?(?:\.(.*))?$
/
gm

Description

Parse CSS Selector in the form element#id.class into its components. Any of the three elements can be missing.

Submitted by Mark - 2 years ago