public static List < String > asListLinesIgnore ( String content , Pattern ignorePattern ) { List < String > retorno = new ArrayList < String > ( ) ; content = content . replace ( CARRIAGE_RETURN , RETURN ) ; content = content . replace ( RETURN , CARRIAGE_RETURN ) ; for ( String str : content . split ( CARRIAGE_RETURN ) ) { if ( ! ignorePattern . matcher ( str ) . matches ( ) ) { retorno . add ( str ) ; } } return retorno ; }
Split string content into list ignoring matches of the pattern