Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
RegEx for parsing CSS
(# comment )
(/\*(?:(?!\*/)[\s\S])*\*/)
(/\*(?:[^*]|\*[^/])*\*/)
(# @keyframes-rule )
(@(?:-webkit-|-moz-)?keyframes(?:[\s\n]|/\*(?:(?!\*/)[\s\S])*\*/)+[a-zA-Z0-9_\-]+(?:[\s\n]|/\*(?:(?!\*/)[\s\S])*\*/)*{(?:[\s\n]|/\*(?:(?!\*/)[\s\S])*\*/)*(?:(?:from|to|[0-9]{1,3}%)(?:[\s\n]|/\*(?:(?!\*/)[\s\S])*\*/)*{(?:[^{}"']|/\*(?:(?!\*/)[\s\S])*\*/|'[^']*'|"[^"]*")*}(?:[\s\n]|/\*(?:(?!\*/)[\s\S])*\*/)*)+(?:[\s\n]|/\*(?:(?!\*/)[\s\S])*\*/)*})
(# ruleset )
((?:[^{}"']|'[^']*'|"[^"]*")+(?:[\s\n]|/\*(?:(?!\*/)[\s\S])*\*/)*{(?:[^{}"']|/\*(?:(?!\*/)[\s\S])*\*/|'[^']*'|"[^"]*")*})
(# block )
({(?:[^{}"']|/\*(?:(?!\*/)[\s\S])*\*/|'[^']*'|"[^"]*")*})
(# declaration )
([a-zA-Z\-]+(?:\s|/\*(?:(?!\*/)[\s\S])*\*/)*:(?:\s|/\*(?:(?!\*/)[\s\S])*\*/)*(?:"[^"]*"|'[^']'|[^:;{}])+;?)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.