Skip to content

Instantly share code, notes, and snippets.

@strebl
Created September 2, 2014 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save strebl/252a8f91d7603bf7f89b to your computer and use it in GitHub Desktop.
Save strebl/252a8f91d7603bf7f89b to your computer and use it in GitHub Desktop.
$(function() {
var text = $("#code textarea").text();
var patt = new RegExp(/(.+?): ?(.+?);/gi);
var matches = [];
while (match = patt.exec(text)) {
console.log(match);
matches.push({ key: match[1], value: match[2] });
}
$("#output").text("");
$(matches).each(function(index, css) {
console.log(css);
$("#output").append(css.key + " " + css.value + "<br>");
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment