I am using a WordPress premium theme that has a 25.000+ lines styles.css. I want to change the font and main color sitewide, and for this I would like to catch ALL classes and IDs that use them for my childtheme.
Manually searching through 25.000 lines and then selecting and copying the classes together is a very slow procedure, and I am sure this can be automated with RegEx, but I only know that it exists but not how it works, especially not for such a vast function.
But at least I could figure out the logic that a script for such a task would need to follow.
So let's say I need a rule that collects ALL classes to which Roboto is assigned.
Basically it needs to
1. find Roboto, then
2. go back to the { and
3. collect everything before { until
4. the last } before, so it needs to go backwards searching
5. Then it needs to add a comma to the last entry, so the list can continue.
The result will be a very big list of comma-separated classes which I can then easily assign the new font to.
Can someone figure out such a RegEx String, or better to say, write such a php script?
... ... last CSS rule ending here.
}
.td-page-content blockquote p,
.td-post-content blockquote p,
.wpb_text_column blockquote p,
.td_block_text_with_title blockquote p,
.bbpress blockquote p,
.woocommerce #tab-description blockquote p,
.mce-content-body blockquote p,
.comment-content blockquote p {
font-family: 'Roboto', sans-serif;
font-size: 32px;
line-height: 40px;
font-weight: 400;
font-style: italic;
text-align: center;
text-transform: uppercase;
color: ...
... ... ...