<pre>
MandrakeSoft Corporate Server 4.0 x86_64
MandrakeSoft Corporate Server 4.0
MandrakeSoft Linux Mandrake 9.0
MandrakeSoft Linux Mandrake 10.1 x86_64
MandrakeSoft Linux Mandrake 10.1
</pre>求一正则,把上面pre标签中的换行用<br>替换想要的结果是:
MandrakeSoft Corporate Server 4.0 x86_64<br>MandrakeSoft Corporate Server 4.0<br>......
MandrakeSoft Corporate Server 4.0 x86_64
MandrakeSoft Corporate Server 4.0
MandrakeSoft Linux Mandrake 9.0
MandrakeSoft Linux Mandrake 10.1 x86_64
MandrakeSoft Linux Mandrake 10.1
</pre>求一正则,把上面pre标签中的换行用<br>替换想要的结果是:
MandrakeSoft Corporate Server 4.0 x86_64<br>MandrakeSoft Corporate Server 4.0<br>......
alert(str.replace(/\s*<\/?pre>\s*/ig,"").replace(reg,"<br>"));