I am very weak in regex
and i think the task i have been assigned requires regex
.
suppose i have following string #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
.
Now what my requirement is to replace #B#anystring#B#
with <div class="format">anystring</div>
.
I think regex
is required but i have no idea what the regex would be.
Please give any suggestion.
updated
String regex="#B#";
String textFormated = text.replaceAll(regex,"<div class='formated'>");
System.out.println(textFormated);
this is what i tried till now.It just replaces #B#
with <div class='formated'>
but there is slight complication in adding end of div.The end of div should be added if :#B#
is found.But how these both regex can be used together.