Java 8 Matcher - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Matcher class.

This code example shows how to use the following methods: group, matches
                } 
            } 
        } 
        version = prop.getProperty("atmosphere.version");
        Matcher matcher = versionPattern.matcher(version);
        if (matcher.matches()) {
            dotedVersion = matcher.group(1);
            major = Integer.parseInt(matcher.group(2));
            minor = Integer.parseInt(matcher.group(3));
            micro = Integer.parseInt(matcher.group(4));
        } else { 
            dotedVersion = "no.version";
            major = -1;
            minor = -1;
            micro = -1;
        } 
    } 
 
    /** 
     * Return the raw version derived frok the project's pom.xml 
Full Snippet Info
10
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: group, matches
This code example shows how to use the following methods: group, matches
        if (text.isEmpty()) {
            throw new IllegalArgumentException("empty text");
        } 
 
        Matcher m = VERSION_PATTERN.matcher(text);
        if (!m.matches()) {
            throw new IllegalArgumentException("invalid version format: " + text);
        } 
 
        protocolName = m.group(1);
        majorVersion = Integer.parseInt(m.group(2));
        minorVersion = Integer.parseInt(m.group(3));
        this.text = protocolName + '/' + majorVersion + '.' + minorVersion;
        this.keepAliveDefault = keepAliveDefault;
        bytes = null;
    } 
 
    /** 
     * Creates a new HTTP version with the specified protocol name and version 
     * numbers.  You will not need to create a new instance unless you are 
Full Snippet Info
10
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: find, group
      return; 
    } 
 
    String content = consume(response.getEntity());
    Matcher matcher = PRODUCT_NAME_PRICE_PATTERN.matcher(content);
    if (matcher.find()) {
      append(matcher.group(1));
      append(matcher.group(2));
    } 
    setLink(uri);
  } 
 
  private static String consume(HttpEntity entity) {
    Log.d(TAG, "Consuming entity");
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    InputStream in = null;
    try { 
      in = entity.getContent();
      byte[] buffer = new byte[1024];
      int bytesRead;
Full Snippet Info
9
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: group, matches
    } 
 
    @JsonCreator 
    public static Size parse(String size) {
        final Matcher matcher = SIZE_PATTERN.matcher(size);
        checkArgument(matcher.matches(), "Invalid size: " + size);
 
        final long count = Long.parseLong(matcher.group(1));
        final SizeUnit unit = SUFFIXES.get(matcher.group(2));
        if (unit == null) {
            throw new IllegalArgumentException("Invalid size: " + size + ". Wrong size unit");
        } 
 
        return new Size(count, unit);
    } 
 
    private final long count;
    private final SizeUnit unit;
 
    private Size(long count, SizeUnit unit) {
Full Snippet Info
9
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: group
    public File getFile() {
        return file;
    } 
 
    public String getBaseName() {
        return matcher.group(1);
    } 
 
    public VersionNumber getVersion() { 
        return VersionNumber.parse(matcher.group(2));
    } 
 
    public boolean isGroovyAll() { 
        return getBaseName().equals("groovy-all");
    } 
 
    public boolean isIndy() { 
        return matcher.group(3) != null;
    } 
 

9
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: group, matches
   */ 
  public static String sanitizeDbUri(String uri)
  { 
    String result = uri;
    Matcher m = ORA_JDBC_URI_PATTERN.matcher(uri);
    if (m.matches())
    { 
      result = m.group(1) + "*/*" + m.group(4);
    } 
    else if (uri.startsWith("jdbc:mysql:"))
    { 
      Matcher m1 = MYSQL_JDBC_PATTERN1.matcher(result);
      Matcher m2 = MYSQL_JDBC_PATTERN2.matcher(result);
      if (m1.find())
      { 
        result = m1.replaceAll("($1*)");
      } 
      else if (m2.find())
      { 
        result = m2.replaceAll("$1*");
Full Snippet Info
9
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: group, matches
 
    static Pattern expression = Pattern.compile("^\\$\\{(.*)\\}$");
 
    public static Object evaluate(String value, String defaultValue) {
        Matcher matcher = expression.matcher(value);
        if (matcher.matches()) {
            return Play.configuration.getProperty(matcher.group(1), defaultValue);
        } 
        return value;
    } 
} 
Full Snippet Info
9
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: find, group
This code example shows how to use the following methods: find, group
            month = getMonth(rfcMatcher.group(2));
            year = getYear(rfcMatcher.group(3));
            timeOfDay = getTime(rfcMatcher.group(4));
        } else { 
            Matcher ansicMatcher = HTTP_DATE_ANSIC_PATTERN.matcher(timeString);
            if (ansicMatcher.find()) {
                month = getMonth(ansicMatcher.group(1));
                date = getDate(ansicMatcher.group(2));
                timeOfDay = getTime(ansicMatcher.group(3));
                year = getYear(ansicMatcher.group(4));
            } else { 
                throw new IllegalArgumentException();
            } 
        } 
 
        // FIXME: Y2038 BUG! 
        if (year >= 2038) {
            year = 2038;
            month = Calendar.JANUARY;
            date = 1;
Full Snippet Info
9
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Java 8 Matcher Questions & Answers:

See Code Examples for Java 8 Matcher Methods: