Package java.util.regex

Examples of java.util.regex.Matcher.groupCount()


    Matcher m = inputPattern.matcher(new String(payload));
    if (!m.matches()) {
      return Lists.newArrayList();
    }
   
    if (m.groupCount() != colNames.size()) {
      return Lists.newArrayList();
    }
   
    try {
      rowKey = getRowKey();
View Full Code Here


  {
    if (null == durationStr) return 0;
    TimeUnit unit = defaultUnit;
    Matcher m = DURATION_PATTERN.matcher(durationStr);
    if (!m.matches()) throw new InvalidConfigException("invalid duration string: " + durationStr);
    if (1 < m.groupCount() && null != m.group(2) && 0 < m.group(2).length())
    {
      char unitChar1 = m.group(2).charAt(0);
      switch (unitChar1)
      {
      case 'n':
View Full Code Here

  {
    if (null == sizeString) return 0;
    long unit = 1L;
    Matcher m = BYTE_SIZE_PATTERN.matcher(sizeString);
    if (!m.matches()) throw new InvalidConfigException("invalid byte-size string: " + sizeString);
    if (1 < m.groupCount() && null != m.group(2) && 0 < m.group(2).length())
    {
      char unitChar1 = m.group(2).charAt(0);
      switch (unitChar1)
      {
      case 'k': unit = 1000L; break;
View Full Code Here

        for (Pattern pathPattern : pathPatterns) {
            Matcher matcher = pathPattern.matcher(path);
            if (matcher.find()) {
                // assuming that first group is tenantId in the path, we can
                // make group number configurable.
                if (matcher.groupCount() >= 1) {
                    String tenantId = matcher.group(1);
                    final Tenant tenant = this.tenantProvider.getTenant(tenantId);
                    if (tenant != null) {
                        return tenant;
                    }
View Full Code Here

                                          // get the pieces,
        } else {
          // Extract the relevant pieces and write to a file in the output dir
          Matcher matcher = EXTRACTION_PATTERN.matcher(buffer);
          while (matcher.find()) {
            for (int i = 1; i <= matcher.groupCount(); i++) {
              if (matcher.group(i) != null) {
                outBuffer.append(matcher.group(i));
              }
            }
            outBuffer.append(LINE_SEPARATOR).append(LINE_SEPARATOR);
View Full Code Here

     * @return the action
     */
    public static String extractActionFromContentType(String contentType) {
        if (contentType != null) {
            Matcher matcher = ACTION_PATTERN.matcher(contentType);
            if (matcher.find() && matcher.groupCount() == 1) {
                return matcher.group(1).trim();
            }
        }
        return TransportConstants.EMPTY_SOAP_ACTION;
    }
View Full Code Here

     */
    public static String setActionInContentType(String contentType, String action) {
        Assert.hasLength(contentType, "'contentType' must not be empty");
        if (StringUtils.hasText(action)) {
            Matcher matcher = ACTION_PATTERN.matcher(contentType);
            if (matcher.find() && matcher.groupCount() == 1) {
                StringBuffer buffer = new StringBuffer();
                matcher.appendReplacement(buffer, "action=" + action);
                matcher.appendTail(buffer);
                return buffer.toString();
            }
View Full Code Here

            _minorVersion = 0;
            _buildNumber = 0;
            try {
                Matcher matcher = SUN_JAVA_VERSION.matcher(version);
                if (matcher.matches()) {
                    int groups = matcher.groupCount();
                    _majorVersion = Double.parseDouble(matcher.group(1));
                    if (groups >= 3 && matcher.group(3) != null) {
                        _minorVersion = Integer.parseInt(matcher.group(3));
                    }
                    if (groups >= 5 && matcher.group(5) != null) {
View Full Code Here

            }
            catch (NumberFormatException e) {
                try {
                    Matcher matcher = SUN_JAVA_VERSION_SIMPLE.matcher(version);
                    if (matcher.matches()) {
                        int groups = matcher.groupCount();
                        _majorVersion = Double.parseDouble(matcher.group(1));
                        if (groups >= 3 && matcher.group(3) != null) {
                            _minorVersion = Integer.parseInt(matcher.group(3));
                        }
                    }
View Full Code Here

        Matcher matcher = VERSION_PATTERN.matcher(version);
        if(matcher.matches()) {
            this.major = Integer.parseInt(matcher.group(1));
            this.minor = Integer.parseInt(matcher.group(2));
            this.revision = Integer.parseInt(matcher.group(3));
            if(matcher.groupCount() > 3) {
                this.extra = matcher.group(4);
            }
            else {
                this.extra = null;
            }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.