public void test5() {
        Pattern pat = Pattern.compile("(\\sLog\\b)");
        String s = "public Log myLog =LogFactory.getFactory().getInstance(myClass.class);";
        Matcher m = pat.matcher(s);
        assertTrue(m.find());
        String r = m.replaceAll(" Logger");
        assertEquals("public Logger myLog =LogFactory.getFactory().getInstance(myClass.class);", r);

        Pattern pat2 = Pattern.compile("LogFactory.getFactory\\(\\).getInstance\\(");
        m = pat2.matcher(r);
        assertTrue(m.find());
        r = m.replaceAll("LoggerFactory.getLogger(");
        assertEquals("public Logger myLog =LoggerFactory.getLogger(myClass.class);", r);
    }
In this test we combine two Pattern to achieve the intended conversion
slf4j-migrator/src/test/java/org/slf4j/migrator/AternativeApproach.java