JSFiddle - React, Tailwind, and code Playground

by jfriend00

JavaScript

var str = " <style>\n.body{\n width:2px; \n height:3px; \n  } \n</style>"; 
var re = /\.body\s*\{[^\}]*?width\s*:\s*(.*);/m;
var matches = str.match(re);
if (matches) {
    var width = matches[1];
    alert(width);
}