<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
	<meta http-equiv="Access-Control-Allow-Origin" content="*">
    <title>htmlToWord</title>
	<script src="https://cdn.bootcss.com/jquery/2.2.4/jquery.js"></script>
	<script>
		$(function(){
			var str = '<p style="color:red;font-size:23px;">dsafjskdsafh斯柯达花费多少空间</p><p>https://files.cnblogs.com/files/wj204/ali.gif</p>";'
			console.log(str.match(/<([a-zA-Z1-6]+)(\s*[^>]*)?>/g))
                    console.log(str.replace(/<([a-zA-Z1-6]+)(\s*[^>]*)?>/g, "<$1>"))
			var str2 = str.replace(/<([a-zA-Z1-6]+)(\s*[^>]*)?>/g, "<$1>");
                    console.log(str2.match(/<p>(.*?)<\/p>/g))
                    console.log(str2.replace(/<p>(.*?)<\/p>/g, '<span style="font-size:12pt;color: reb(0,0,0)">$1</span>'))
		})
	</script>
</head>
<body>
</body>
</html>

  

posted on 2019-05-27 17:50  阿梅M  阅读(7296)  评论(2编辑  收藏  举报