Package java.util.regex

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


      String magnet = parseTextForMagnets(decodeString);
      if (magnet != null) {
        pattern = Pattern.compile("(.*)/[0-9]+", Pattern.CASE_INSENSITIVE);
        matcher = pattern.matcher(decodeString);
        if (matcher.find()) {
          String name = matcher.group(1);
          return magnet + "&dn=" + encode(name);
        }
        return magnet;
      }
    }
View Full Code Here


    Pattern pat = Pattern.compile("<.*a\\s++.*href=\"?([^\\'\"\\s>]++).*",
        Pattern.CASE_INSENSITIVE);
    Matcher m = pat.matcher(text);
    if (m.find()) {
      String sURL = m.group(1);
      try {
        sURL = URLDecoder.decode(sURL);
      } catch (Exception e) {
        // sometimes fires a IllegalArgumentException
        // catch everything and ignore.
View Full Code Here

          Matcher match = SET_STATEMENT.matcher(commands[0]);
          if (match.matches()) {
            if (resultsMode == ResultsMode.RESULTSET) {
              throw new TeiidSQLException(JDBCPlugin.Util.getString("StatementImpl.set_result_set")); //$NON-NLS-1$
            }
            String key = match.group(1);
            String value = match.group(2);
            if (ExecutionProperties.NEWINSTANCE.equalsIgnoreCase(key) && Boolean.valueOf(value)) {
              this.getMMConnection().getServerConnection().cleanUp();
            } else {
              JDBCURL.addNormalizedProperty(key, value, this.driverConnection.getExecutionProperties());
View Full Code Here

          if (match.matches()) {
            if (resultsMode == ResultsMode.RESULTSET) {
              throw new TeiidSQLException(JDBCPlugin.Util.getString("StatementImpl.set_result_set")); //$NON-NLS-1$
            }
            String key = match.group(1);
            String value = match.group(2);
            if (ExecutionProperties.NEWINSTANCE.equalsIgnoreCase(key) && Boolean.valueOf(value)) {
              this.getMMConnection().getServerConnection().cleanUp();
            } else {
              JDBCURL.addNormalizedProperty(key, value, this.driverConnection.getExecutionProperties());
            }
View Full Code Here

          if (match.matches()) {
          logger.finer("Executing as transaction statement"); //$NON-NLS-1$
            if (resultsMode == ResultsMode.RESULTSET) {
              throw new TeiidSQLException(JDBCPlugin.Util.getString("StatementImpl.set_result_set")); //$NON-NLS-1$
            }
            String command = match.group(1);
            Boolean commit = null;
            if (StringUtil.startsWithIgnoreCase(command, "start")) { //$NON-NLS-1$
              //TODO: this should force a start and through an exception if we're already in a txn
              this.getConnection().setAutoCommit(false);
            } else if (command.equalsIgnoreCase("commit")) { //$NON-NLS-1$
View Full Code Here

          if (match.matches()) {
          logger.finer("Executing as show statement"); //$NON-NLS-1$
            if (resultsMode == ResultsMode.UPDATECOUNT) {
              throw new TeiidSQLException(JDBCPlugin.Util.getString("StatementImpl.show_update_count")); //$NON-NLS-1$
            }
            String show = match.group(1);
            if (show.equalsIgnoreCase("PLAN")) { //$NON-NLS-1$
              List<ArrayList<Object>> records = new ArrayList<ArrayList<Object>>(1);
              PlanNode plan = driverConnection.getCurrentPlanDescription();
              if (plan != null) {
                ArrayList<Object> row = new ArrayList<Object>(3);
View Full Code Here

            if(!funcVisited)
            {
                final Matcher funcMatcher = FUNC_EXP.matcher(value);
                if(funcMatcher.find() && funcMatcher.start() == 0 && funcMatcher.end() == value.length())
                {
                    final int funcVal = Integer.parseInt(funcMatcher.group(2));

                    // SWT.F1 is (1 << 24) + 10
                    swtAccelerator = swtAccelerator | ((1 << 24) + (9 + funcVal));
                    displayValue.append(funcMatcher.group(0)).append(DELIM);
View Full Code Here

                {
                    final int funcVal = Integer.parseInt(funcMatcher.group(2));

                    // SWT.F1 is (1 << 24) + 10
                    swtAccelerator = swtAccelerator | ((1 << 24) + (9 + funcVal));
                    displayValue.append(funcMatcher.group(0)).append(DELIM);

                    funcVisited = true;
                    matched = true;
                }
            }
View Full Code Here

                continue;

            final Matcher valMatcher = SANCTIONED_EXP.matcher(value);
            if(valMatcher.find() && valMatcher.start() == 0)
            {
                final char c = valMatcher.group().charAt(0);

                // avoid possible duplicates (\t is index 0)
                final int subStrIndex = displayValue.indexOf(c + DELIM);
                if(subStrIndex == 1 || (subStrIndex > 1 && displayValue.substring(subStrIndex - 1, subStrIndex).equals(DELIM)))
                    continue;
View Full Code Here

            throw new DynamicError("err:FORG0001", "Illegal representation as xs:duration: "
                    + literal);
        }

        final String y, mo, d;
        int year = ((y = match.group(2)) == null) ? 0 : Integer.parseInt(y);
        int month = ((mo = match.group(4)) == null) ? 0 : Integer.parseInt(mo);
        int day = ((d = match.group(6)) == null) ? 0 : Integer.parseInt(d);
        String x;
        int hour = ((x = match.group(9)) == null) ? 0 : Integer.parseInt(x);
        int minute = ((x = match.group(11)) == null) ? 0 : Integer.parseInt(x);
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.