I have a string like this:
var str="<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title></title></head><body><table><tr><td style="color:#FF0000">demo1</td><td style="color:#FF0000">demo2</td></tr></table></body></html>";
I have to get the contents inside all td
elements alone using regular expression in JavaScript. My output should be:
var str="demo1 demo2"
How to do this? Any idea?