I have this string: .class_99 { width:325px; height:40px; background-color: none; padding: 3px; } .class_100 { padding-bottom: 1px; padding-top: 4px; padding-left: 3px; padding-right: 3px; vertical-align:top; text-align:left; } Code (markup): I need 2 regular expressions written to extract the values of width and height in the class_99 class. So the values in this case would be 325px and 40px. Can someone write that?
You can try with this: ^\.class_99(.*)width:([ ]*)([0-9]+)px;(.*)height:([ ]*)([0-9]+)px; Results are in $3 and $6 You can try yourself on this page: http://www.fileformat.info/tool/regex.htm