我在regex
中很弱,我認爲我已經分配的任務需要regex
。 假設我有以下字符串#B#Objectives:#B#We aimed to review how personality characteristics contribute to the onset, maintenance or modulation of.#B#Method:#B#The databases Medline and PsychINFO were examined from 1967 to 2012 to
。用html div取代某些模式
現在我的要求是用<div class="format">anystring</div>
替換#B#anystring#B#
。
我認爲regex
是必需的,但我不知道什麼是正則表達式。
請給出任何建議。
更新
String regex="#B#";
String textFormated = text.replaceAll(regex,"<div class='formated'>");
System.out.println(textFormated);
這就是我想直到now.It剛剛替換#B#
與<div class='formated'>
但如果:#B#
被發現有輕微的併發症,增加股利div.The結束的結束應該加入但這兩個正則表達式如何一起使用。
你有什麼已經做了?你試過的任何代碼? – Howard 2013-05-07 05:30:07