remove Bold markdown - Java java.lang

Java examples for java.lang:String Markdown

Description

remove Bold markdown

Demo Code


//package com.java2s;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    private static String removeBold(String brief) {
        String pString = "(\\*\\*)(.*?)(\\*\\*)";
        Pattern pattern = Pattern.compile(pString, Pattern.MULTILINE);
        Matcher matcher = pattern.matcher(brief);
        while (matcher.find()) {
            brief = brief.replace(matcher.group(0),
                    matcher.group(matcher.groupCount() - 1));
        }//from w ww.ja  va 2  s.  c  o m
        return brief;
    }
}

Related Tutorials