Code example for Matcher

Methods: group, groupCount, matches

0
     * suffix characters and digits to allow for rollup of the keys. 
     */ 
    private void postProcessSamsung() { 
        final String dcModel = deviceClassification.getModel();
        final Matcher m = WMF_APP_ANDROID_UA_PAT.matcher(dcModel);
        if (m.matches() && m.groupCount() == 4) {
            final String name = m.group(1);
            final String value = m.group(3);
            final String valueCleaned = value.replaceAll("\\d", "");
            model = name + "-" + valueCleaned;
        } else { 
            model = m.group(0) != null ? m.group(0) : dcModel;
        } 
    } 
 
    /** 
     * If the useragent string is not identified as a mobile device using dClass 
     * then we need to determine whether it's an Wikimedia mobile app. This 
     * function iterates over a list of regular expressions to look for a match. 
     */ 
    private void detectMobileApp() {