Package com.google.gwt.regexp.shared

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


      return v;
    }

    private void parse(String s) {
      if (s != null) {
        RegExp re = RegExp.compile("([a-zA-Z0-9]+)\\((.*?)\\)", "g");
        for (MatchResult r = re.exec(s); r != null; r = re.exec(s)) {
          setFromString(r.getGroup(1), r.getGroup(2));
        }
      }
    }
View Full Code Here


    }

    public List<String> getEntityBrowserText() {
        String enteredText = entityBrowserTextField.getText().trim();
        List<String> result = new ArrayList<String>();
        RegExp regExp = RegExp.compile("\n");
        SplitResult split = regExp.split(enteredText);
        for(int i = 0; i < split.length(); i++) {
            result.add(split.get(i));
        }
        return result;
    }
View Full Code Here

        bodyField.setHTML(new SafeHtmlBuilder().appendHtmlConstant(modifiedHtml).toSafeHtml());
    }


    private String makeLinksOpenInNewWindow(String html) {
        RegExp linkRegExp = RegExp.compile("(<a)([^>]*)(>)", "g");
        return linkRegExp.replace(html, "$1$2 target=\"_blank\"$3");
    }
View Full Code Here

        return sb.toString();
    }

    public static PlacePropertyValueList parse(String token) {
        final String globalFlag = "g";
        RegExp regExp = RegExp.compile("([^" + PROPERTY_VALUE_SEPARATOR + "]+)" + PROPERTY_VALUE_SEPARATOR + "([^" + PROPERTY_VALUE_ITEM_SEPARATOR + "]+)" + PROPERTY_VALUE_ITEM_SEPARATOR, globalFlag);
        MatchResult matchResult = regExp.exec(token);
        Builder resultBuilder = builder();
        while(matchResult != null) {
            String name = URL.decodeQueryString(matchResult.getGroup(1));
            String value = URL.decodeQueryString(matchResult.getGroup(2));
            resultBuilder.set(name, value);
            final int matchLength = matchResult.getGroup(0).length();
            final int matchStart = matchResult.getIndex();
            final int nextIndex = matchStart + matchLength;
            regExp.setLastIndex(nextIndex);
            matchResult = regExp.exec(token);
        }
        return resultBuilder.build();
    }
View Full Code Here

        // no newline so can't fail
        return true;
    }

    private int countNewlines(String string) {
        RegExp newlineRegExp = RegExp.compile(newlineRegex, "g");

        int count = 0;
        MatchResult matchResult = newlineRegExp.exec(string);
        while (matchResult != null) {
            count++;
            matchResult = newlineRegExp.exec(string);
        }
        return count;
    }
View Full Code Here

        }
        return -1;
    }

    private ArrayList<String> getTagList(String src) {
        final RegExp regExp = RegExp.compile(tagRegex, "g");

        ArrayList<String> list = new ArrayList<String>();
        MatchResult result = regExp.exec(src);
        while (result != null) {
            String node = result.getGroup(0);
            list.add(node);
            result = regExp.exec(src);
        }
        return list;
    }
View Full Code Here

        }
        return list;
    }

    private List<String> listMissing(String compareFrom, String compareTo) {
        final RegExp regExp = RegExp.compile(tagRegex, "g");

        String tmp = compareTo;
        ArrayList<String> unmatched = new ArrayList<String>();
        MatchResult result = regExp.exec(compareFrom);

        while (result != null) {
            String node = result.getGroup(0);
            if (!tmp.contains(node)) {
                unmatched.add(node);
            } else {
                int index = tmp.indexOf(node);
                String beforeNode = tmp.substring(0, index);
                String afterNode = tmp.substring(index + node.length());
                tmp = beforeNode + afterNode; // remove matched node from
            }
            result = regExp.exec(compareFrom);
        }
        return unmatched;
    }
View Full Code Here

    }

    protected ArrayList<String> findVars(String inString) {
        ArrayList<String> vars = new ArrayList<String>();
        // compile each time to reset index
        RegExp varRegExp = RegExp.compile(VAR_REGEX, GLOBAL_FLAG);
        MatchResult result = varRegExp.exec(inString);
        while (result != null) {
            vars.add(result.getGroup(0));
            result = varRegExp.exec(inString);
        }
        return vars;
    }
View Full Code Here

        // Slight modification to make input easier
        final String timeFrag = "((?:T| )(?:(?:[01][0-9]|2[0-3]):(?:[0-5][0-9]):(?:[0-5][0-9])(?:\\.[0-9]+)?|(?:24:00:00(?:\\.0+)?)))?"; // Group 2
        final String timeZoneFrag = "(Z|(?:\\+|-)(?:(?:0[0-9]|1[0-3]):[0-5][0-9]|14:00))?"; // Group 3

        String pattern = "^" + yearMonthDayFrag + timeFrag + timeZoneFrag + "$";
        RegExp regExp = RegExp.compile(pattern);
        MatchResult matchResult = regExp.exec(lexicalValue);
        if(matchResult == null) {
            throw new IllegalArgumentException();
        }
        String matchedYearMonthDay = matchResult.getGroup(1);
        String matchedTime = matchResult.getGroup(2);
View Full Code Here

      categoryKeyRegexp = CATEGORY_URL_PREFIX + "(.+)/";
    } else if (url.startsWith(CATEGORY_URL_PREFIX)
        && url.contains(GOOD_URL_PREFIX)) {
      categoryKeyRegexp = CATEGORY_URL_PREFIX + "(.+)/good";

      RegExp goodRegexp = RegExp.compile(".+" + GOOD_URL_PREFIX
          + "(.+)/");
      MatchResult goodMatch = goodRegexp.exec(url);
      if (goodMatch == null) {
        showGoodUrlError();
        return;
      }
      final String goodKey = goodMatch.getGroup(1);
      //1
      callback = getRenderGoodCallback(goodKey);
    } else {
      showCategoryUrlError();
      return;
    }

    RegExp p = RegExp.compile(categoryKeyRegexp);
    MatchResult m = p.exec(url);
    if (m == null) {
      showNoCategoryUrlError(callback);
      return;
    }
    final String categoryKey = m.getGroup(1);
View Full Code Here

TOP

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

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.