question: protected String extractLink ( final CharacterIterator ci ) { final StringBuilder sbuf = new StringBuilder ( ) ; char ch = ci . current ( ) ; char terminator = ' ' ; if ( ch == '\'' ) { terminator = ch ; } while ( ch != CharacterIterator . DONE ) { if ( ch == terminator ) { if ( terminator == ' ' ) { ch = ci . next ( ) ; if ( ch == '#' ) { ch = ' ' ; } else { ci . previous ( ) ; break ; } } else { break ; } } sbuf . append ( ch ) ; ch = ci . next ( ) ; } int len = sbuf . length ( ) ; while ( len != 0 ) { if ( ! isWordDelim ( sbuf . charAt ( -- len ) ) ) { len ++ ; break ; } sbuf . setLength ( len ) ; ci . previous ( ) ; } if ( len == 0 ) { return null ; } return sbuf . toString ( ) ; }
target:  Extract link content from a character iterator. It is assumed that the '#' has already been eaten. It leaves the character iterator at the first character after the link text.