Package java.util.regex

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


            return null;
        }
        m.reset();

        while (m.find()) {
            m.appendReplacement(newName, m.group(1) + Character.toUpperCase(m.group(2).charAt(0)));
        }

        m.appendTail(newName);

        return newName.toString();
View Full Code Here


      // note: order matters
      replacement = replacement.replaceAll("\\\\", "\\\\\\\\");
      replacement = replacement.replaceAll("\\$", "\\\\\\$");

      matcher.appendReplacement(sb, replacement);
    }
    matcher.appendTail(sb);
    return sb.toString();
  }
View Full Code Here

        String resolvedParameterValue;
        while (matcher.find()) {
            String parameter = matcher.group(1);
            resolvedParameterValue = resolveParameter(parameter, bundle, locale, recurse);

            matcher.appendReplacement(sb, sanitizeForAppendReplacement(resolvedParameterValue));
        }
        matcher.appendTail(sb);
        return sb.toString();
    }
View Full Code Here

                    resolvedParameterValue = variable.toString();
                }
            } else {
                resolvedParameterValue = parameter;
            }
            matcher.appendReplacement(sb, sanitizeForAppendReplacement(resolvedParameterValue));
        }
        matcher.appendTail(sb);
        return sb.toString();
    }
View Full Code Here

        }
        Matcher matcher = NAMESPACE_PATTERN.matcher(path);
        StringBuffer sb = new StringBuffer();
        while (matcher.find()) {
            String replacement = "/" + MANGLED_NAMESPACE_PREFIX + matcher.group(1) + MANGLED_NAMESPACE_SUFFIX;
            matcher.appendReplacement(sb, replacement);
        }
        matcher.appendTail(sb);
        return sb.toString();
    }
View Full Code Here

        }
        Matcher matcher = MANGLED_NAMESPACE_PATTERN.matcher(path);
        StringBuffer sb = new StringBuffer();
        while (matcher.find()) {
            String replacement = "/" + matcher.group(1) + NAMESPACE_SEPARATOR;
            matcher.appendReplacement(sb, replacement);
        }
        matcher.appendTail(sb);
        return sb.toString();
    }
View Full Code Here

                    // namespace prefix
                    final Session session = getSession();
                    if ( session != null ) {
                        session.getNamespaceURI(namespace);
                        final String replacement = MANGLE_NAMESPACE_IN_PREFIX + namespace + MANGLE_NAMESPACE_IN_SUFFIX;
                        m.appendReplacement(buf, replacement);
                    } else {
                        logger.debug("mangleNamespaces: '{}' is not a prefix, not mangling", namespace);
                    }

View Full Code Here

                    // namespace prefix
                    final Session session = getSession();
                    if ( session != null ) {
                        session.getNamespaceURI(namespace);
                        final String replacement = MANGLE_NAMESPACE_OUT_PREFIX + namespace + MANGLE_NAMESPACE_OUT_SUFFIX;
                        m.appendReplacement(buf, replacement);
                    } else {
                        logger.debug("unmangleNamespaces: '{}' is not a prefix, not unmangling", namespace);
                    }

View Full Code Here

        if (rp.playerWillVanish()) { //the player will vanish as a result of this, special handling
          int cutlen = CommandsEX.getConf().getInt("replacements.cutoff.length", 1);
          String cuttext = CommandsEX.getConf().getString("replacements.cutoff.indicator", "--*");
 
          String rep = m.group().substring(0, cutlen).concat(cuttext);
          m.appendReplacement(sb, rep);
          e.setMessage(sb.toString());
          //e.setCancelled(true);
          //e.getPlayer().chat(sb.toString()); //chat first
 
          rp.executeEffects(env); //then execute the replacement
View Full Code Here

        //loop through with find/replace
        do { //use do while, due to the find() invocation above
          // test if it is all upper, and replace with all upper (if we have this set up in the regex itself - in config file)
          if (rp.getSameOutputCase() && allUpper && m.group().toUpperCase().equals(m.group())) {
            m.appendReplacement(sb, rp.executeString(env).toUpperCase());
          } else {
            m.appendReplacement(sb, rp.executeString(env));
          }
        } while (m.find());
        m.appendTail(sb);
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.