Parse HTML styles in Regexp

Don't know how to create a Regexp request to check smth like that:

p {
  margin:0
}
.c0 {
  width:468.0pt;
  background-color:#ffffff;
  padding:72.0pt 72.0pt 72.0pt 72.0pt
}
.c1 {
  direction:ltr
}

It's a part of style in HTML document.So, p - tag, in every style of this tag (c0, c1, etc) there could be different count of properties, Every property has format of PROPERTY_NAME:PROPERTY_VALUE and this properties separated with ;

How to consider all of this things in one Regexp?

Thanks a lot.

Answers


Try this:

\.?\w+\s*{\s*(?:(?:(?<name>[^{};]+)\s*:\s*(?<value>[^{};]+));?)+\s*}

Output:

Analyzer:


Need Your Help

Checking multiple $_ POST words with PHP

php jquery ajax post

I'm working with a page that, once a link is called this script checks and if the POST contains the keyword it and then finds that page. However no matter how I organize this if it doesn't work.

Simple map app on Android(google api v2). Doesnt work. Error

java android google-maps

I try to program an easy map app on Android but the only outcome are errors. I tried to program it the way it should be but it still doesn't work.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.