Examples of groupCount()


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

  public static final String getServerLocation(String repositoryLocation) {
    // Try to parse the server URL from the repository URL
    Pattern urlPattern = Pattern.compile("(.*)/" + Protocol.REPOSITORIES + "/[^/]*/?");
    Matcher matcher = urlPattern.matcher(repositoryLocation);

    if (matcher.matches() && matcher.groupCount() == 1) {
      return matcher.group(1);
    }
    else {
      return null;
    }
View Full Code Here

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

  static private int parseLine(String line) throws IOException {
    int balony = 0;
    Matcher matcher = dataPattern.matcher(line);
    if (matcher.matches()) {
      for (int i=1; i<=matcher.groupCount(); i++) {
        String r = matcher.group(i);
        if (r == null) continue;
        int value = (int) Long.parseLong(r.trim());
        balony += value;
      }
View Full Code Here

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

    while ((line = br.readLine()) != null) {
      if (p_comment.matcher(line).find()) {
        continue;
      }
      m = p_parameter.matcher(line);
      if (m.find() && (m.groupCount() == 6)) {
        GridParameter p = new GridParameter(Integer.parseInt(m.group(3)), m.group(4), m.group(6),
            m.group(5));
        getDiscipline(Integer.parseInt(m.group(1))).getCategory(
            Integer.parseInt(m.group(2))).setParameter(p);
      }
View Full Code Here

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

    byte[] bytearrayMessage = null;

    try {
      Matcher matcher = ImapToolkit.getMessagePattern().matcher(url);
      matcher.find();
      if( matcher.groupCount()>0 ) {
        // We found a message url. Determine the message UID from the url.
        int messageUID = Integer.parseInt(matcher.group(3));
        mLog.debug("Read mime message uid: " + messageUID + " for IMAP url: " + url);
        Session session = Session.getInstance(new Properties());
   
View Full Code Here

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

    if (mQueryText != null) {
      // Remove the mimetype field if the query contains it

      Matcher matcher = mimetypeFieldPattern.matcher(mQueryText);
      boolean found = matcher.find();
      if (found && matcher.groupCount() > 0) {
        // the first group is the mimetype field identifier
        mimeTypeFieldText = matcher.group(1);
        queryText = mQueryText.replace(mimeTypeFieldText, "");
        //System.out.println("Query after mimetype removing: " + queryText);
View Full Code Here

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

  public static String createURLWithoutPath(String completeUrl) throws RegainException {

    String result = "";
    Matcher matcher = urlPatternLeft.matcher(completeUrl);
    matcher.find();
    if (matcher.groupCount() > 0) {
      try {
        return matcher.group(1) + "/";
      } catch (IllegalStateException ex) {
        // No match found
        return "";
View Full Code Here

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

      throw new JavaSoundUrlParserException("Expected URL to start with: " + "javasound://");
    Matcher m = pattern.matcher(url);
    if (!m.matches())
      throw new JavaSoundUrlParserException("URL does not match regular expression for javasound URLs");
   
    int groupCount = m.groupCount();
   
    double rate = AudioFormat.NOT_SPECIFIED;
    int bits = AudioFormat.NOT_SPECIFIED;
    int channels = AudioFormat.NOT_SPECIFIED;
    int endian = AudioFormat.NOT_SPECIFIED;
View Full Code Here

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

        al.add(new FixedString(s.substring(i, m.start())));
    }

    // Expect 6 groups in regular expression
    String[] sa = new String[6];
    for (int j = 0; j < m.groupCount(); j++)
        {
        sa[j] = m.group(j + 1);
//         System.out.print(sa[j] + " ");
        }
//     System.out.println();
View Full Code Here

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

            // name based guess
            if (buddy.getUser().indexOf("@") == -1) {
                Pattern p = Pattern
                        .compile("^(aim|msn|yahoo|icq|gadu-gadu)[-_.].*");
                Matcher m = p.matcher(buddy.getUser());
                if (m.matches() && m.groupCount() >= 1) {
                    String type = m.group(1);
                    if (type != null) {
                        statusIcon = Standard
                                .getIcon("imagethemes/statusicons/"
                                        + type
View Full Code Here

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

     */
    public static String find(String self, Pattern pattern, Closure closure) {
        Matcher matcher = pattern.matcher(self);
        if (matcher.find()) {
            if (hasGroup(matcher)) {
                int count = matcher.groupCount();
                List groups = new ArrayList(count);
                for (int i = 0; i <= count; i++) {
                    groups.add(matcher.group(i));
                }
                return InvokerHelper.toString(closure.call(groups));
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.