public void doReplaceRegExpTests( RegExpProvider pREP ) throws Exception {
RegExp re01 = pREP.make( "a", "b" );
assertEquals( "b", re01.replaceAll( "a" ) );
assertEquals( "bb", re01.replaceAll( "aa" ) );
assertEquals( "ba", re01.replaceFirst( "aa" ) );
assertEquals( "xb", re01.replaceFirst( "xa" ) );
RegExp re02 = pREP.make( "a" );
assertEquals( "", re02.replaceAll( "a" ) );
try {
RegExp re03 = pREP.make( "*" );
fail();
}
catch( RegExpException ree ) {
//System.out.println( ree );
}
RegExp re04 = pREP.make( "a(b+)c", "ca$1" );
assertEquals( "cabbbabbbc", re04.replaceFirst( "abbbcabbbc" ) );
RegExp re05 = pREP.make( "A", "b", new RegExp.ModeSet( RegExp.Mode.CaseInsensitive ) );
assertEquals( "bbc", re05.replaceFirst( "abc" ) );
RegExp re06 = pREP.make( "A.", "b", new RegExp.ModeSet( RegExp.Mode.CaseInsensitive, RegExp.Mode.DotMatchesNewline ) );
assertEquals( "bbc", re06.replaceFirst( "a\nbc" ) );
}