Code example for Matcher

Methods: find, group

0
     */ 
    protected int getProperty(String name, String stty) {
        // try the first kind of regex 
        Pattern pattern = Pattern.compile(name + "\\s+=\\s+([^;]*)[;\\n\\r]");
        Matcher matcher = pattern.matcher(stty);
        if (!matcher.find()) {
            // try a second kind of regex 
            pattern = Pattern.compile(name + "\\s+([^;]*)[;\\n\\r]");
            matcher = pattern.matcher(stty);
            if (!matcher.find()) {
                // try a second try of regex 
                pattern = Pattern.compile("(\\S*)\\s+" + name);
                matcher = pattern.matcher(stty);
                if (!matcher.find()) {
                    return -1; 
                } 
            } 
        } 
        return parseControlChar(matcher.group(1));
    } 
 
    private int parseControlChar(String str) {
        // under 
        if ("<undef>".equals(str)) {