Package java.util.regex

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


      @Override public SplittingIterator iterator(
          final Splitter splitter, CharSequence toSplit) {
        final Matcher matcher = separatorPattern.matcher(toSplit);
        return new SplittingIterator(splitter, toSplit) {
          @Override public int separatorStart(int start) {
            return matcher.find(start) ? matcher.start() : -1;
          }

          @Override public int separatorEnd(int separatorPosition) {
            return matcher.end();
          }
View Full Code Here


      Matcher m = patternLink.matcher(stringWithMarkup);
      boolean foundPos = m.find();
      int wrapperOpen = 0;
      int wrapperClose = 0;
      if (foundPos) {
        wrapperOpen = m.start(0);
        wrapperClose = m.end(0);
        // check if found position does belong to start position
        if (wrapperOpen > startSPos) {
          foundPos = false;
        } else {
View Full Code Here

      // Case 2: translated within an 'input' tag
      if (!foundPos) {
        m = patternInput.matcher(stringWithMarkup);
        foundPos = m.find();
        if (foundPos) {
          wrapperOpen = m.start(0);
          wrapperClose = m.end(0);
          // check if found position does belong to start position
          if (wrapperOpen > startSPos) foundPos = false;
          else {
            // ignore within a checkbox
View Full Code Here

      // Case 3: translated within a tag attribute of an element - don't offer
      // inline translation
      m = patAttribute.matcher(stringWithMarkup);
      foundPos = m.find();
      if (foundPos) {
        wrapperOpen = m.start(0);
        wrapperClose = m.end(0);
        // check if found position does belong to start position
        if (wrapperOpen > startSPos) foundPos = false;
        else {
          // found a patter in within an attribute, skip this one
View Full Code Here

            String matchedBundle = matcher.group(1);
            if (matchedKey.equals(origKey)
                && ( (matchedBundle== null && bundleName.equals(originBundleName)  )
                || originBundleName.equals(matchedBundle)) ){
              StringBuffer newValue = new StringBuffer();
              newValue.append(value.substring(0, matcher.start()));
              newValue.append("$");
              if (movePackage){
                if (!targetBundleName.equals(matchedBundle) ){
                  newValue.append(targetBundleName);
                }
View Full Code Here

    StringBuffer resolvedValue = new StringBuffer();
    int lastPos = 0;
    Matcher matcher = resolvingKeyPattern.matcher(value);
    while (matcher.find()) {
      resolvedValue.append(value.substring(lastPos, matcher.start()));
      String toResolvedBundle = matcher.group(1);
      String toResolvedKey = matcher.group(2);
      if (toResolvedBundle == null || toResolvedBundle.equals("")) {
        // $:my.key is valid syntax, points to $current.bundle:my.key
        toResolvedBundle = bundleName;
View Full Code Here

      if (toResolvedBundle.equals(bundleName) && currentProperties != null) {
        // Resolve within bundle
        String resolvedKey = currentProperties.getProperty(toResolvedKey);
        if (resolvedKey == null) {
          // Not found, use original (added in next iteration)
          lastPos = matcher.start();
        } else {
          resolvedValue
              .append(resolveValuesInternalKeys(locale, bundleName, toResolvedKey, currentProperties, overlayEnabled, recursionLevel, resolvedKey));
          lastPos = matcher.end();
        }
View Full Code Here

        if (StringHelper.containsNonWhitespace(resolvedKey)) {
          resolvedValue.append(resolvedKey);
          lastPos = matcher.end();
        } else {
          // Not found, use original (added in next iteration)
          lastPos = matcher.start();
        }
      }
      // add resolved key to references index
      if (cachingEnabled) {
        String identifyer = buildI18nItemIdentifyer(toResolvedBundle, toResolvedKey);
View Full Code Here

        // find LAST matching date in string
        int match = -1;
        Matcher pm = DATE_PATTERN.matcher(fstr);
        while (pm.find()) {
            match = pm.start();
//      System.out.println("MATCH: " + match + ": " + pm.group(0));
        }

        if (match == -1) {
//      System.out.println("NO MATCH: \"" + fstr + "\"");
View Full Code Here

        } else
            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

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.