1

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.

2
  • does it have to take into account new lines? Commented Jun 23, 2011 at 6:49
  • No, there is just one text line... Commented Jun 23, 2011 at 6:52

1 Answer 1

1

Try this:

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

Output: enter image description here

Analyzer: enter image description here

Sign up to request clarification or add additional context in comments.

3 Comments

That's great! Thanks a lot! But I just can't understand it :). If you could add a little of explanation - you'll be the best! :)
Well, I advise you to use a Regex editor. For example, I use Expresso (ultrapico.com/Expresso.htm), which has a built-in Regex analyzer.
Awesome! Thanks again! That's really what I need to get into Regexp!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.