Package java.util.regex

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


            hm.put("year", year);

        int len = fstr.length();
        StringBuffer newf = new StringBuffer();
        if (pm.start() > 0)
            newf.append(fstr.substring(0, pm.start()));
        if (pm.end() < len)
            newf.append(fstr.substring(pm.end(), len));
        return newf.toString();
    }
View Full Code Here


      }
      if (locator == null)
      {
         throw new NotFoundException("Could not find resource for relative : " + path + " of full path: " + request.getUri().getRequestUri());
      }
      if (matcher.find(start) && matcher.start() == start)
      {
         // a non-matched locator path must have a '/' immediately after.  A locator cannot match a partial segment
         String group0 = matcher.group(0);
         int charAt = start + group0.length();
View Full Code Here

    String replacedCurlyURI = PathHelper.replaceEnclosedCurlyBraces(uri);
    Matcher matcher = PathHelper.URI_PARAM_PATTERN.matcher(replacedCurlyURI);
    int i = 0;
    while (matcher.find())
    {
      if (matcher.start() > i)
      {
        writer.println(" uri += '"
            + replacedCurlyURI.substring(i, matcher.start()) + "';");
      }
      String name = matcher.group(1);
View Full Code Here

    while (matcher.find())
    {
      if (matcher.start() > i)
      {
        writer.println(" uri += '"
            + replacedCurlyURI.substring(i, matcher.start()) + "';");
      }
      String name = matcher.group(1);
      writer.println(" uri += REST.Encoding.encodePathSegment(params." + name + ");");
      i = matcher.end();
    }
View Full Code Here

        /*
          NOTE: This text fitting algorithm returns everytime it finds a line break character,
          as it's intended to evaluate the width of just a single line of text at a time.
        */
        for(
          int spaceIndex = matcher.start(1),
            spaceEnd = matcher.end(1);
          spaceIndex < spaceEnd;
          spaceIndex++
          )
        {
View Full Code Here

    private final static Pattern protp = Pattern.compile("smb://|ftp://|http://|https://");

    private static final int find(final String s, final Pattern m, final int start) {
        final Matcher mm = m.matcher(s.subSequence(start, s.length()));
        if (!mm.find()) return Integer.MAX_VALUE;
        final int p = mm.start() + start;
        //final int p = s.indexOf(m, start);
        return (p < 0) ? Integer.MAX_VALUE : p;
    }

    private MultiProtocolURI absolutePath(final String relativePath) {
View Full Code Here

      String stringValue = (String)value;
      int index = 0;
      Matcher unescapedMatcher = UnescapedPattern.matcher(stringValue);
      while(unescapedMatcher.find())
      {
        int start = unescapedMatcher.start();
        if(start > index)
        {buffer.append(stringValue.substring(index,start));}

        buffer.append(
          '#' + Integer.toHexString(
View Full Code Here

    StringBuilder buffer = new StringBuilder();
    int index = 0;
    Matcher escapedMatcher = EscapedPattern.matcher(value);
    while(escapedMatcher.find())
    {
      int start = escapedMatcher.start();
      if(start > index)
      {buffer.append(value.substring(index,start));}

      buffer.append(
        (char)Integer.parseInt(
View Full Code Here

        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)
                        + length));
                if (pos != null) {
                    fields[pos.intValue()][1] = ma.group(i);
                    System.out.println("Match " + i + ": " + ma.group(i));
View Full Code Here

        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)
                        + length));
                if (pos != null) {
                    fields[pos.intValue()][1] = ma.group(i);
                    System.out.println("Match " + i + ": " + ma.group(i));
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.