Package java.util.regex

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


       
        // get the different help arguments
        String module_name = null;
        String help_key = null;
        module_name = logsearch_matcher.group(1);
        if (logsearch_matcher.groupCount() > 1)
        {
          help_key = logsearch_matcher.group(2);
          if (0 == help_key.length())
          {
            help_key = null;
View Full Code Here


      synchronized (sb)
      {
        do
        {
          actual_url = url_matcher.group(1);
          if (url_matcher.groupCount() > 1)
          {
            visual_url = url_matcher.group(2);
          }
          else
          {
View Full Code Here

    private ParsedModuleStringNotation splitDescriptionIntoModuleNotationAndArtifactType(String notation) {
        Matcher matcher = EXTENSION_SPLITTER.matcher(notation);
        boolean hasArtifactType = matcher.matches();
        if (hasArtifactType) {
            if (matcher.groupCount() != 2) {
                throw new InvalidUserDataException("The description " + notation + " is invalid");
            }
            return new ParsedModuleStringNotation(matcher.group(1), matcher.group(2));
        }
        return new ParsedModuleStringNotation(notation, null);
View Full Code Here

      }
    }
    int width = Integer.parseInt( m.group( 1 ) );
    int height = Integer.parseInt( m.group( 2 ) );
    int xpos, ypos;
    if( m.groupCount() > 3 )
    {
      xpos = Integer.parseInt( m.group( 3 ) );
      ypos = Integer.parseInt( m.group( 4 ) );
    }
    else
View Full Code Here

    // are there references to a message and optional to an attachment in the message
    if (urlName.getFile() != null) {
      try {
        Matcher matcher = messagePattern.matcher(url);
        matcher.find();
        if (matcher.groupCount() > 0) {
          if (matcher.group(1).startsWith("message")) {
            result = true;
          }
        }
View Full Code Here

  public static String cutMessageIdentifier(String url) throws Exception {

    String result = "";
    Matcher matcher = messagePattern.matcher(url);
    matcher.find();
    if (matcher.groupCount() > 0) {
      // the first group is the whole message identifier
      result = url.replaceFirst("/" + matcher.group(1), "");
    //System.out.println(matcher.group(1) + " " + matcher.group(2));
    }
    return result;
View Full Code Here

    Matcher m = p.matcher("fred/the/eta_211/");
    //boolean b = m.matches();
    if ( m.matches())
    {
      System.out.println( "Matches" );
      System.out.println( "numGroups : " + m.groupCount());
      for ( int i = 0; i <= m.groupCount(); i++)
      {
        System.out.println( "Group[" + i + "]: " + m.group( i) );
      }
    }
View Full Code Here

    //boolean b = m.matches();
    if ( m.matches())
    {
      System.out.println( "Matches" );
      System.out.println( "numGroups : " + m.groupCount());
      for ( int i = 0; i <= m.groupCount(); i++)
      {
        System.out.println( "Group[" + i + "]: " + m.group( i) );
      }
    }
    else
View Full Code Here

  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

  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

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.