Package com.google.gwt.regexp.shared

Examples of com.google.gwt.regexp.shared.MatchResult


   * @param replacer   a callback that maps matched strings into new values
   */
  private static String replace(RegExp expression, String text,
      RegExpReplacer replacer) {
    expression.setLastIndex(0);
    MatchResult mresult = expression.exec(text);
    StringBuffer toReturn = new StringBuffer();
    int lastIndex = 0;
    while (mresult != null) {
      toReturn.append(text.substring(lastIndex, mresult.getIndex()));
      toReturn.append(replacer.replace(mresult.getGroup(0)));
      lastIndex = mresult.getIndex() + 1;
      mresult = expression.exec(text);
    }
    toReturn.append(text.substring(lastIndex));
    return toReturn.toString();
  }
View Full Code Here


        SplitResult result = ITEMS.split(RESOURCES.auditLog().getText());
        for (int i = 0; i < result.length(); i++) {
            String nextResult = result.get(i);
            if (nextResult != null && nextResult.length() != 0) {
                String itemText = nextResult.trim() + "\n}";
                MatchResult match = ITEM.exec(itemText);
                if (match != null) {
                    store.add(parseItem(match));
                }
            }
        }
View Full Code Here

        SplitResult result = ITEMS.split(RESOURCES.auditLog().getText());
        for (int i = 0; i < result.length(); i++) {
            String nextResult = result.get(i);
            if (nextResult != null && nextResult.length() != 0) {
                String itemText = nextResult.trim() + "\n}";
                MatchResult match = ITEM.exec(itemText);
                if (match != null) {
                    store.add(parseItem(match));
                }
            }
        }
View Full Code Here

        {
            if (!REGEXP.test(time))
            {
                throw new ParseException("Illegal time: \"" + time + "\"");
            }
            MatchResult match = REGEXP.exec(time);
            String hoursGroup = match.getGroup(1);
            if (!time.startsWith(hoursGroup))
            {
                throw new ParseException("Illegal time: \"" + time + "\"");
            }
            long hours = asLong(hoursGroup);
            Seperator seperator = asSeperator(match.getGroup(2));
            long minutes = asLong(match.getGroup(3));
            Unit unit = asUnit(match.getGroup(4));

            if (seperator == COLUMN)
            {
                // Unit is ignored!
                if (hours < 0 || hours > 23)
View Full Code Here

  public boolean isValid(String value, ConstraintValidatorContext context) {
    if (value == null) {
      return true;
    }
    MatchResult match = pattern.exec(value);
    if (match == null) {
      return false;
    }
    // Must match the entire string
    return match.getGroup(0).length() == value.length();
  }
View Full Code Here

  protected String replaceParameters(String message,
      Function<String, String> replacer) {
    StringBuffer sb = new StringBuffer();
    int index = 0;

    MatchResult matcher;
    while ((matcher = MESSAGE_PARAMETER_PATTERN.exec(message)) != null) {
      String matched = matcher.getGroup(0);
      sb.append(message.substring(index, matcher.getIndex()));
      Object value = replacer.apply(removeCurlyBrace(matched));
      sb.append(value == null ? matched : value);
      index = MESSAGE_PARAMETER_PATTERN.getLastIndex();
    }
    if (index < message.length()) {
View Full Code Here

TOP

Related Classes of com.google.gwt.regexp.shared.MatchResult

Copyright © 2018 www.massapicom. 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.