I've build a very simple RTE which allows me to colorize my text and make it bold. I've worked with an Iframe and designmode.
What I now get is something like this:
this is my Text which is <strong>strong</strong> and <font color="#ff0000">colored</font> or <strong><font-color="#00ff00">both</font></strong>
Now I want to convert this HTML into an JavaScript object to transform it into an SVG with SnapSvg. For this I tried a lot of diffrent regular expressions but I've never worked with them much and the result is not what I need.
I was trying something like this:
function getMatches (text) {
var regexp = /<[^>]*>/;
var matches = regexp.exec(text);
if(matches !== null) {
console.log(matches);
}
}
Does anyone have a better regex or maybe an idea how get the object I need?