Test, validate and match regular expressions
This regex matches CSS rules by capturing the selector in the first group and the properties inside the curly braces in the second group. It requires the selector to start with a #, ., or a lowercase letter, followed by at least one lowercase letter or underscore, making it suitable for parsing simple CSS snippets. You can use this in JavaScript with the global flag to iterate over all style blocks in a stylesheet or to extract styling definitions from HTML or CSS text.