Search in sources :

Example 66 with Matcher

use of java.util.regex.Matcher in project jetty.project by eclipse.

the class SslContextFactory method removeExcludedCipherSuites.

protected void removeExcludedCipherSuites(List<String> selected_ciphers) {
    for (String excludeCipherSuite : _excludeCipherSuites) {
        Pattern excludeCipherPattern = Pattern.compile(excludeCipherSuite);
        for (Iterator<String> i = selected_ciphers.iterator(); i.hasNext(); ) {
            String selectedCipherSuite = i.next();
            Matcher m = excludeCipherPattern.matcher(selectedCipherSuite);
            if (m.matches())
                i.remove();
        }
    }
}
Also used : Pattern(java.util.regex.Pattern) Matcher(java.util.regex.Matcher) SNIMatcher(javax.net.ssl.SNIMatcher)

Example 67 with Matcher

use of java.util.regex.Matcher in project jetty.project by eclipse.

the class SslContextFactory method processIncludeCipherSuites.

protected void processIncludeCipherSuites(String[] supportedCipherSuites, List<String> selected_ciphers) {
    for (String cipherSuite : _includeCipherSuites) {
        Pattern p = Pattern.compile(cipherSuite);
        boolean added = false;
        for (String supportedCipherSuite : supportedCipherSuites) {
            Matcher m = p.matcher(supportedCipherSuite);
            if (m.matches()) {
                added = true;
                selected_ciphers.add(supportedCipherSuite);
            }
        }
        if (!added)
            LOG.info("No Cipher matching '{}' is supported", cipherSuite);
    }
}
Also used : Pattern(java.util.regex.Pattern) Matcher(java.util.regex.Matcher) SNIMatcher(javax.net.ssl.SNIMatcher)

Example 68 with Matcher

use of java.util.regex.Matcher in project che by eclipse.

the class DockerfileParserTest method testConditionPatternEmptyCondition2.

@Test
public void testConditionPatternEmptyCondition2() {
    String conditionTemplate = "aaa>=?bbb:ccc";
    Matcher m = Dockerfile.TEMPLATE_CONDITIONAL_PATTERN.matcher(conditionTemplate);
    assertTrue(m.matches());
    assertEquals(m.groupCount(), 5);
    assertEquals(m.group(1), "aaa");
    assertEquals(m.group(2), ">=");
    assertEquals(m.group(3), "");
    assertEquals(m.group(4), "bbb");
    assertEquals(m.group(5), "ccc");
}
Also used : Matcher(java.util.regex.Matcher) Test(org.testng.annotations.Test)

Example 69 with Matcher

use of java.util.regex.Matcher in project che by eclipse.

the class DockerfileParserTest method testConditionPatternEmptyConditionAndNoExpression2.

@Test
public void testConditionPatternEmptyConditionAndNoExpression2() {
    String conditionTemplate = "aaa=?bbb:";
    Matcher m = Dockerfile.TEMPLATE_CONDITIONAL_PATTERN.matcher(conditionTemplate);
    assertTrue(m.matches());
    assertEquals(m.groupCount(), 5);
    assertEquals(m.group(1), "aaa");
    assertEquals(m.group(2), "=");
    assertEquals(m.group(3), "");
    assertEquals(m.group(4), "bbb");
    assertEquals(m.group(5), "");
}
Also used : Matcher(java.util.regex.Matcher) Test(org.testng.annotations.Test)

Example 70 with Matcher

use of java.util.regex.Matcher in project hbase by apache.

the class HTableDescriptor method addCoprocessorToMap.

/**
   * Add coprocessor to values Map
   * @param specStr The Coprocessor specification all in in one String formatted so matches
   * {@link HConstants#CP_HTD_ATTR_VALUE_PATTERN}
   * @return Returns <code>this</code>
   */
private HTableDescriptor addCoprocessorToMap(final String specStr) {
    if (specStr == null)
        return this;
    // generate a coprocessor key
    int maxCoprocessorNumber = 0;
    Matcher keyMatcher;
    for (Map.Entry<Bytes, Bytes> e : this.values.entrySet()) {
        keyMatcher = HConstants.CP_HTD_ATTR_KEY_PATTERN.matcher(Bytes.toString(e.getKey().get()));
        if (!keyMatcher.matches()) {
            continue;
        }
        maxCoprocessorNumber = Math.max(Integer.parseInt(keyMatcher.group(1)), maxCoprocessorNumber);
    }
    maxCoprocessorNumber++;
    String key = "coprocessor$" + Integer.toString(maxCoprocessorNumber);
    this.values.put(new Bytes(Bytes.toBytes(key)), new Bytes(Bytes.toBytes(specStr)));
    return this;
}
Also used : Bytes(org.apache.hadoop.hbase.util.Bytes) Matcher(java.util.regex.Matcher) HashMap(java.util.HashMap) Map(java.util.Map) TreeMap(java.util.TreeMap)

Aggregations

Matcher (java.util.regex.Matcher)12473 Pattern (java.util.regex.Pattern)5010 ArrayList (java.util.ArrayList)1516 IOException (java.io.IOException)904 HashMap (java.util.HashMap)565 File (java.io.File)487 Test (org.junit.Test)442 BufferedReader (java.io.BufferedReader)428 Map (java.util.Map)363 List (java.util.List)287 InputStreamReader (java.io.InputStreamReader)266 HashSet (java.util.HashSet)236 MalformedURLException (java.net.MalformedURLException)163 URL (java.net.URL)155 Date (java.util.Date)152 InputStream (java.io.InputStream)147 Field (java.lang.reflect.Field)130 PatternSyntaxException (java.util.regex.PatternSyntaxException)128 ParseException (java.text.ParseException)127 LinkedHashMap (java.util.LinkedHashMap)120