This discussion is archived
1 Reply Latest reply: Jul 31, 2011 12:31 PM by DarrylBurke RSS

Regular expression for BBcode list to html list

KT Journeyer
Currently Being Moderated
we are migrating BBforum to Jive forum.
BBforums has data which contains BBcode Strings.i found the follwoing code after googled.

public static String bbcode(String text) {
String html = text;
Map<String, String> bbMap = new HashMap<String, String>();
bbMap.put("(\r\n|\r|\n|\n\r)", "<br/>");
bbMap.put("\\[b\\](.+?)\\[b\\]", "<strong>$1</strong>");
for (Map.Entry entry : bbMap.entrySet()) {
html =
html.replaceAll(entry.getKey().toString(), entry.getValue().toString());
return html;

i have BBcode with format like
[list] [*]blue[*]red[*] green[list]
i have to replace this by <ul><li>blue</li><li>red</li>

Can any one sugeest me java regular expression which replace as above

Edited by: 875452 on Jul 31, 2011 8:03 AM


  • Correct Answers - 10 points
  • Helpful Answers - 5 points