contacts

(+359) 88 339 4445

Buy All 39 Premium WordPress Themes for $54.99

Regex to Find CSS Selector and Declaration

In case you want to find all of the CSS Selectors by a class name and their declarations, it can be easily achieved using an Regex.

Here is an example:

.class1 {
   font-size: 12px;
   text-align: center;
}

...

.class1 {
   font-size: 16px;
   text-align: left;
}

...

.class1 {
   font-size: 22px;
}

You can find all of the .class1 using the following RegEx code:

\.class1 {(.|\n)*?}

About the Author

Tihomir Ivanov is a WordPress and Salesforce Commerce Cloud (SFCC) developer, founder of tishonator.com, a fan of Linux and Open Source, Minimalism (in Design and Life), Sci-fi, Fantasy, Classic and History books :)

Leave a Reply