Package com.google.gwt.regexp.shared

Examples of com.google.gwt.regexp.shared.RegExp.exec()


  public void testSetTabIndex() {
    // Skip this test on Safari 3 because it does not support focusable divs.
    String userAgent = Window.Navigator.getUserAgent();
    if (userAgent.contains("Safari")) {
      RegExp versionRegExp = RegExp.compile("Version/[0-3]", "ig");
      MatchResult result = versionRegExp.exec(userAgent);
      if (result != null && result.getGroupCount() > 0) {
        return;
      }
    }
View Full Code Here


   */
  public HashMap<String, Prefix> getPrefixHashMap() {
    HashMap<String, Prefix> queryPrefixes = new HashMap<String, Prefix>();
    RegExp regExp = RegExp.compile(PREFIX_PATTERN, "gm");
    while (true) {
      MatchResult matcher = regExp.exec(getQuery());
      if (matcher == null)
        break;
      queryPrefixes.put(matcher.getGroup(2), new Prefix(matcher.getGroup(1), matcher.getGroup(2)));
    }
    return queryPrefixes;
View Full Code Here

   * screenshot containing lots of popups
   */
  public static boolean isCrawler() {
    String userAgent = JsMethods.getUserAgent();
    RegExp regExp = RegExp.compile(".*(" + CRAWL_USER_AGENTS + ").*");
    MatchResult matcher = regExp.exec(userAgent);
    boolean matchFound = (matcher != null);
    return matchFound;
  }

  /**
 
View Full Code Here

    }

    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

    }

    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 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);
View Full Code Here

            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();
    }

    public static Builder builder() {
View Full Code Here

    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

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

    @Override
View Full Code Here

    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);
        }
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.