Examples of groupCount()


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

        Pattern pa = Pattern.compile(filename);
        Matcher ma = pa.matcher(f.getName().toLowerCase());

        int length = 0;
        if (ma.matches()) {
            for (int i = 1; i <= ma.groupCount(); i++) {
                // we can find a group that is not in the hashtable, if the user
                // entered %1-%1, for ex.
                // We work only with multiple ignore masks, not other..
                Integer pos = (Integer) filenameHash.get(new Integer(ma
                        .start(i)
View Full Code Here

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

        pa = Pattern.compile(directory);
        ma = pa.matcher(f.getParent().toLowerCase());

        length = 0;
        if (ma.matches()) {
            for (int i = 1; i <= ma.groupCount(); i++) {
                // we can find a group that is not in the hashtable, if the user
                // entered %1-%1, for ex.
                // We work only with multiple ignore masks, not other..
                Integer pos = (Integer) directoryHash.get(new Integer(ma
                        .start(i)
View Full Code Here

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

     * @return null if not parseable
     */
    private static entryInfo parseListData(final String line) {
        // groups: 1: rights, 2: size, 3: month, 4: day, 5: time or year, 6: name
        final Matcher tokens = lsStyle.matcher(line);
        if (tokens.matches() && tokens.groupCount() == 6) {
            filetype type = filetype.file;
            if (tokens.group(1).startsWith("d")) type = filetype.directory;
            if (tokens.group(1).startsWith("l")) type = filetype.link;
            long size = -1;
            try {
View Full Code Here

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

        StringBuffer sb = new StringBuffer();
        String varName, varValue;
        String condlVal;  // Conditional : value
        while (matcher.find()) {
            varName = matcher.group(1);
            condlVal = ((matcher.groupCount() > 1) ? matcher.group(2) : null);
            varValue = System.getProperty(varName);
            if (condlVal != null) {
                // Replace varValue (the value to be substituted), with
                // the post-:+ portion of the expression.
                varValue = ((varValue == null)
View Full Code Here

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

        String varValue;
        int varIndex;
        String condlVal;  // Conditional : value
        while (matcher.find()) {
            varIndex = Integer.parseInt(matcher.group(1)) - 1;
            condlVal = ((matcher.groupCount() > 1) ? matcher.group(2) : null);
            varValue = ((varIndex < subs.length) ? subs[varIndex] : null);
            if (condlVal != null) {
                // Replace varValue (the value to be substituted), with
                // the post-:+ portion of the expression.
                varValue = ((varValue == null)
View Full Code Here

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

    Pattern p = Pattern.compile(replacing); // the regular expression
    Matcher m = p.matcher(pstrSourceString); // check matching
    if (m.find() == false) // then nothing matched
      return pstrSourceString;

    int intGroupCount = m.groupCount();
    if (replacements.length < intGroupCount)
      throw new RuntimeException("replacements missing: " + replacements.length + " replacement(s) defined but " + intGroupCount + " groups found");

    // no groups, exchange the whole string
    if (intGroupCount == 0) {
View Full Code Here

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

  }

  private String parseEncoding(String xmlContent) {
    Matcher matcher = xmlEncodingPattern.matcher(xmlContent);
    if (matcher.find()){
      if (matcher.groupCount()>0) return matcher.group(1);     
    }
    return null;
  }

  public SOSLogger getLog(){
View Full Code Here

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

    if (m.find() == false) // then nothing matched
      return pstrSourceString;

    String[] replacements = replacement.split(";");

    int intGroupCount = m.groupCount();
    if (replacements.length < intGroupCount)
      throw new JobSchedulerException("replacements missing: " + replacements.length + " replacement(s) defined but " + intGroupCount + " groups found");

    // no groups, exchange the whole string
    if (intGroupCount == 0) {
View Full Code Here

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

        while (it.hasNext()) {
          Variable currVar = (Variable) it.next();
          String text = currVar.toString();
           
            Matcher matcher = pattern.matcher(text);
            int groupCount = matcher.groupCount();
           
            StringBuffer buffer = new StringBuffer();
           
            int index = 0;
            while ( matcher.find() ) {
View Full Code Here

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

        //System.out.println(s);
        if (m.lookingAt()) {
          int p = position; // TODO p wegrefactorn
          String match = m.group(); // korrekt?
          if (pattern.isIgnoreLastGroup()) {
            assert m.groupCount() > 0;
            String g = m.group(m.groupCount());
            assert g != null;
            assert match.endsWith(g);
            match = match.substring(0, match.length() - g.length());
          }
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.