var list = '<ol>\n'+ '<li>item1</li>\n'+ '<li>item2</li>\n'+ '<li>item3</li>\n'+ '</ol>'; list = list.replace(/(<ol>[\s\S]*?<\/ol>)/gm, '<p>$1</p>'); alert(list);