0
我有一個這樣的字符串來自數據庫。如何使用正則表達式和javascript控制數據
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 ".
我用這condtion打破了新的生產線
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.
這是測試。
我怎樣才能this..thanks提前...
謝謝你的回答,但我再次編輯了這個問題。假設情況如此,假設前面有一些句子? – 2013-04-10 09:03:17
'這是第一個字符串.'將在第一行,'Exception No. 1 ...'將在下一個 – user2264587 2013-04-10 09:11:47