core/src/main/java/org/markdownj/TextEditor.java
public TextEditor replaceAll(Pattern pattern, Replacement replacement) {
        Matcher m = pattern.matcher(text);
        int lastIndex = 0;
        StringBuilder sb = new StringBuilder();
        while (m.find()) {
            sb.append(text.subSequence(lastIndex, m.start()));
            sb.append(replacement.replacement(m));
            lastIndex = m.end();
        }
        sb.append(text.subSequence(lastIndex, text.length()));
        text = sb;
        return this;
    }
public TextEditor replaceAll(Pattern pattern, Replacement replacement) {
        Matcher m = pattern.matcher(text);
        int lastIndex = 0;
        StringBuilder sb = new StringBuilder();
        while (m.find()) {
            sb.append(text.subSequence(lastIndex, m.start()));
            sb.append(replacement.replacement(m));
            lastIndex = m.end();
        }
        sb.append(text.subSequence(lastIndex, text.length()));
        text = sb;
        return this;
    }
public TextEditor replaceAll ( Pattern pattern , Replacement replacement ) { Matcher m = pattern . matcher ( text ) ; int lastIndex = 0 ; StringBuilder sb = new StringBuilder ( ) ; while ( m . find ( ) ) { sb . append ( text . subSequence ( lastIndex , m . start ( ) ) ) ; sb . append ( replacement . replacement ( m ) ) ; lastIndex = m . end ( ) ; } sb . append ( text . subSequence ( lastIndex , text . length ( ) ) ) ; text = sb ; return this ; }
Replace all occurrences of the Pattern.  The Replacement object's replace() method is
called on each match, and it provides a replacement, which is placed literally
(i.e., without interpreting $1, $2 etc.)

@param pattern
@param replacement
@return
Replace all occurrences of the Pattern . The Replacement object s replace () method is called on each match and it provides a replacement which is placed literally ( i . e . without interpreting $1 $2 etc . )