正则表达式,用正则表达式格式化html标签的代码

复制代码 代码如下:

<html>
<head>
</head>
<body>
<style>
#x_edit{
height:320px;
width:540px;
border:1px solid #666666;

color:red;

filter:chroma(color="#0f0f0f");
background-color:#f0f0f0;
font-family:verdana;
font-size:11px;
line-height:13px;
margin-left:16px;
overflow:scroll;
border-left:none;
scrollbar-arrow-color:#666666;
scrollbar-base-color:#666666;
scrollbar-darkshadow-color:#f0f0f0;
scrollbar-face-color:#f0f0f0;
}
</style>
<span _disibledevent=><div contentEditable="true" id="x_edit" style='position:relative;line-height:13px;background-color:#f0f0f0;filter:Chroma(color=#FDFEFF);width:540px;height:320px;overflow:auto;white-space: nowrap; z-index: 2;border:0px'>
<P><html><BR><head><BR></head><BR><body><BR><style><BR>#x_edit,#x_edit1{<BR> height:320px;<BR> width:540px;<BR> border:1px solid #666666;</P>
<P> color:red;</P>
<P> filter:chroma(color="#0f0f0f");<BR> background-color:#f0f0f0;<BR> font-family:verdana;<BR> font-size:11px;<BR> line-height:13px;<BR> margin-left:16px;<BR> overflow:scroll;<BR> border-left:none;<BR> scrollbar-arrow-color:#666666;<BR> scrollbar-base-color:#666666;<BR> scrollbar-darkshadow-color:#f0f0f0;<BR> scrollbar-face-color:#f0f0f0;<BR> }<BR></style><BR><span _disibledevent=></div>

<script>
function abc(){
var s=x_edit.innerText;
s=s.replace(/<\/?(\w+[\s\S]*?)>/gi,function(a){return a.replace(/[\r\n]/gi,"")});
x_edit.innerText=s;
}
</script>
</body>
</html>

Tags:  正则表达式数字 正则表达式语法 js正则表达式 正则表达式

延伸阅读

最新评论

发表评论