I need to match last occurrence of one of two characters with regular expression. In this instance it's either a semi-colon or the close of a comment.
Consider the string:
body {
/* background-image:url('http://www.example.com/image.jpg'); */
height:100%;
width:100%;
}
My goal is to match each CSS property regardless of whether it is commented-out or not. The trouble is, I'm not sure how to write a pattern that would match both normal properties ending with semi-colons and properties that have been commented-out. I'm open to using PHP if it makes it easier.
The pattern below isolates each property but picks up on the semi-colon only, not the close of a comment.
/[^{]*?;/
Any help is appreciated, thank you!