Currently I am separating css rules by using
preg_match_all( '/(?ims)([a-z0-9s,.:()#_\-@>*]+){([^}]*)}/', $content, $arr);
It's working fine. However, if I have double curly brackets like this
@keyframes animationName1{0%{opacity: 0}100%{opacity:1}}div{opacity:0}@keyframes animationName2{0%{opacity: 0}100%{opacity:1}}
this regex will not extract all of the animation rules due to the curly brackets within. I need suport in adapting said rule to look at the outer brackets and ignore the inner ones.
These should be the results:
1: @keyframes animationName1{0%{opacity: 0}100%{opacity:1}}
2: div{opacity:0}
3: @keyframes animationName2{0%{opacity: 0}100%{opacity:1}}