Code example for Pattern

Methods: matcher

0
                     
                    from = s.indexOf(frag);
                    to = from + frag.length();
                } else if (o2 instanceof Pattern) {
                    Pattern pattern = (Pattern) o2;
                    Matcher matcher = pattern.matcher(s);
                    if (matcher.find()) {
                        from = matcher.start();
                        to = matcher.end();
                    } 
                } 
                 
                String[] output = omitFragment ? new String[2] : new String[3];
                if (from > -1) {
                    output[0] = s.substring(0, from);
                    if (omitFragment) {
                        output[1] = s.substring(to);
                    } else { 
                        output[1] = s.substring(from, to);
                        output[2] = s.substring(to);
Stop searching for code, let great code find you!  Add Codota to your java IDE