Package com.google.gwt.regexp.shared

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


      String styleContent = "";
      String nonQ = "";
      while (quotesPattern.getLastIndex() > 0) {
        if (i % 2 == 0) {
          nonQ = m.getGroup(0); // not in quotes - so check
          MatchResult ms = stylePattern.exec(nonQ);
          styleFound = ms.getGroupCount() > 0;
          if (!styleFound && nonQ.indexOf('>') > -1) {
            break; // no more attributes
          }
        } else if (styleFound) {
View Full Code Here


      ArrayList<String> xmlnsNames = new ArrayList<String>();
      ArrayList<String> xmlnsUris = new ArrayList<String>();
      namespaceBindings = new ArrayList<NamespaceBinding>();
     
      RegExp quotesPattern = RegExp.compile("(?:\"(.|\n)*?\"|\'(.|\n)*?\'|[^\'\"]+|['\"])", "gm"); // g=global: = all-matches m=multiline
      MatchResult m = quotesPattern.exec(value);

      int i = 0;
      String nonQ = "";
      boolean awaitingXmlnsUri = false;
      while (quotesPattern.getLastIndex() > 0) {
View Full Code Here

          }
        } else if (awaitingXmlnsUri) {// ends if i % 2
          xmlnsUris.add(m.getGroup(0));
        }
        i++;
        m = quotesPattern.exec(value);
      } // end while
     
      HTMLAttributeNode[] nodeArray = new HTMLAttributeNode[nodeNames.size()];
      for (int y = 0; y < nodeNames.size(); y++) {
        String name = nodeNames.get(y);
View Full Code Here

    public CaptionPosition getCaptionPositionFromElement(
            com.google.gwt.user.client.Element captionWrap) {
        RegExp captionPositionRegexp = RegExp.compile("v-caption-on-(\\S+)");

        // Get caption position from the classname
        MatchResult matcher = captionPositionRegexp.exec(captionWrap
                .getClassName());
        if (matcher == null || matcher.getGroupCount() < 2) {
            return CaptionPosition.TOP;
        }
        String captionClass = matcher.getGroup(1);
View Full Code Here

    sb.append("^");

    int endOfPreviousPattern = 0;
    int startOfNextPattern = 0;

    while ((mr = regex.exec(urlTemplate)) != null) {
      addParamName(paramList, mr);
      startOfNextPattern = mr.getIndex();
     
      // Append any string literal that may occur in the URL path
      // before the next parameter.
View Full Code Here

    RegExp re = RegExp.compile(paramRegex, "g");
    String url = this.urlTemplate;
   
    MatchResult mr;

    while ((mr = re.exec(this.urlTemplate)) != null) {
      String toReplace = mr.getGroup(0);
      String key = mr.getGroup(1);
      if (toReplace.contains(key)) {
        url = url.replace(toReplace, state.get(key).iterator().next());
      }
View Full Code Here

    /*
     * We must not forget to clear the lastIndex since it is a global regex, if
     * we don't it can lead to a false negative for matches.
     */
    regex.setLastIndex(0);
    MatchResult match = regex.exec(text);
    if (match == null || match.getGroup(0).isEmpty()) {
      return false;
    }
   
    do {
View Full Code Here

   
    do {
      int start = regex.getLastIndex() - match.getGroup(0).length();
      edges.add(start);
      edges.add(regex.getLastIndex());
      match = regex.exec(text);
    } while (match != null && !match.getGroup(0).isEmpty());

    // Handles the edge cases of matching at beginning or end of a line
    inMatch = true;
    if (edges.get(0) != 0) {
View Full Code Here

     * is a special size. Rinse and repeat.
     */
    LineDimensionsUtils.markTimeline(getClass(), "Beginning measure line");
    RegExp regexp = UnicodeUtils.regexpNonAsciiTabOrCarriageReturn;
    regexp.setLastIndex(cache.measuredOffset.column);
    MatchResult result = regexp.exec(line.getText());

    if (result != null) {
      double x = 0;
      do {
        // Calculate any x offset up to this point in the line
View Full Code Here

        String match = result.getGroup(0);
        for (int i = 0; i < match.length(); i++) {
          x = addOffsetForResult(cache, match.charAt(i), result.getIndex() + i, line, baseXOffset);
          baseXOffset = x;
        }
        result = regexp.exec(line.getText());
        // we have to ensure we measure through the last zero-width character.
      } while (result != null && result.getIndex() < endColumn && x < endX);
    }

    if (result == null) {
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.