Code example for Matcher

Methods: replaceAll, replaceFirst

0
public class ReplaceTest extends TestCase {
    @TestTargets({ 
        @TestTargetNew( 
            level = TestLevel.PARTIAL_COMPLETE, 
            notes = "Verifies the basic functionality of replaceFirst(java.lang.String) & replaceAll(java.lang.String) methods.", 
            method = "replaceFirst", 
            args = {java.lang.String.class}
        ), 
        @TestTargetNew( 
            level = TestLevel.PARTIAL_COMPLETE, 
            notes = "Verifies the basic functionality of replaceFirst(java.lang.String) & replaceAll(java.lang.String) methods.", 
            method = "replaceAll", 
            args = {java.lang.String.class}
        ) 
    })           
    public void testSimpleReplace() throws PatternSyntaxException { 
        String target, pattern, repl;
 
        target = "foobarfobarfoofo1barfort";
        pattern = "fo[^o]";
        repl = "xxx";