var patt = /<([A-Z][A-Z0-9]*)\b[^>]*>(.*?)<\/\1>/i; var html = "We want write bold and italic here"; console.log(patt.exec(html));