我有一个来自数据库的这样的字符串。
str="This is first string.Exception No. 1: Unprotected vertical openings in accordance with 8.2.5.8 shall be permitted.Exception No. 2:Exception No. 1 to 8.2.5.6(1) shall not apply to patient sleeping and treatment rooms.This is test ".
我正在使用这个条件来打破新行
str = str.replace(/(\s\(\d+\)|exception\s*\:*)/gi, "<br /><br />$1 ");
但我得到这样的输出:这是第一个字符串
Exception No. 1: Unprotected vertical openings in accordance with 8.2.5.8 shall be permitted.
Exception No. 2:
Exception No. 1 to 8.2.5.6(1) shall not apply to patient sleeping and treatment rooms.
但我想得到这样的输出: -
Exception No. 1: Unprotected vertical openings in accordance with 8.2.5.8 shall be permitted.
Exception No. 2:Exception No. 1 to 8.2.5.6(1) shall not apply to patient sleeping and treatment rooms.
这是测试。
我怎么能得到这个..提前谢谢...