Package com.google.gwt.regexp.shared

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


     * ? is replaced with a single \S to match any non-whitespace
     */
    RegExp mimicLookbehind = RegExp.compile("([\\\\]*)([?*])", "g");
    StringBuilder wildcardStr = new StringBuilder(escaped);
   
    for (MatchResult match = mimicLookbehind.exec(wildcardStr.toString()); match != null;
        match = mimicLookbehind.exec(wildcardStr.toString())) {
      // in some browsers an optional group is null, in others its empty string
      if (match.getGroup(1) != null && !match.getGroup(1).isEmpty()) {
        // We undo double-escaping of backslashes performed by the naive escape
        int offset = match.getGroup(1).length() / 2;
View Full Code Here


     */
    RegExp mimicLookbehind = RegExp.compile("([\\\\]*)([?*])", "g");
    StringBuilder wildcardStr = new StringBuilder(escaped);
   
    for (MatchResult match = mimicLookbehind.exec(wildcardStr.toString()); match != null;
        match = mimicLookbehind.exec(wildcardStr.toString())) {
      // in some browsers an optional group is null, in others its empty string
      if (match.getGroup(1) != null && !match.getGroup(1).isEmpty()) {
        // We undo double-escaping of backslashes performed by the naive escape
        int offset = match.getGroup(1).length() / 2;
        wildcardStr.delete(match.getIndex(), match.getIndex() + offset);
View Full Code Here

    StringBuilder builder = new StringBuilder();
    ArgumentFormatHelper helper = new ArgumentFormatHelper(args);

    RegExp formatMatcher = RegExp.compile("(%s)|(%d)", "ig");
    int lastIndex = 0;
    MatchResult result = formatMatcher.exec(template);
    while (result != null) {
      String fragment = template.substring(lastIndex, result.getIndex() - 1);
      builder.append(fragment);
      builder.append(helper.next());
View Full Code Here

  public static String parseClientContent(String content) {
    RegExp p = RegExp.compile("\\[{2}((?:.)*?)\\]{2}", "g");
    MatchResult m;
    StringBuffer sb = new StringBuffer();
    int beginIndex = 0;
    while ((m = p.exec(content)) != null) {
      String one = m.getGroup(1);
      String[] split = one.split("\\|");
      int endIndex = m.getIndex();

      sb.append(content.substring(beginIndex, endIndex));
View Full Code Here

  public static String getLinkHost(String link) {
    if (link != null) {
      // It doesn't seem as if java.net.URL is GWT-friendly.  Thus...  GWT regular expressions!
      RegExp regExp = RegExp.compile("(\\w+?)://([\\-\\.\\w]+?)/.*");
      // toLowerCase is okay because nothing we're interested in is case sensitive.
      MatchResult result = regExp.exec(link.toLowerCase());

      if (result != null) {
        String protocol = result.getGroup(1);
        String host = result.getGroup(2);
        if (PROTOCOL_WHITELIST.contains(protocol)) {
View Full Code Here

   public final String getOffsetParseError(int offsetline)
   {
      String error = getParseError();
      String lineRegex = "line (\\d+),";
      RegExp reg = RegExp.compile(lineRegex);
      MatchResult result = reg.exec(error);
      if (result == null || result.getGroupCount() < 2)
         return getParseError();
      else
      {
         Integer newLine = Integer.parseInt(result.getGroup(1)) + offsetline;
View Full Code Here

      {
         // consider the list element indicator (-) to be part of the node's
         // indentation, to prevent list continuations from being treated as
         // sibling nodes
         RegExp whitespace = RegExp.compile("^\\s*-?\\s*");
         MatchResult result = whitespace.exec(yamlLine);
         if (result == null)
            return "";
         else
            return result.getGroup(0);
      }
View Full Code Here

      public List<YamlTreeNode> children = new ArrayList<YamlTreeNode>();
     
      private String getKey(String line)
      {
         RegExp keyReg = RegExp.compile("^\\s*([^:]+):");
         MatchResult result = keyReg.exec(line);
         if (result == null)
            return "";
          else
            return result.getGroup(1);
      }
View Full Code Here

   @Override
   public void onConsoleWriteInput(ConsoleWriteInputEvent event)
   {
      // when a file is sourced, replay all the breakpoints in the file.
      RegExp sourceExp = RegExp.compile("source(.with.encoding)?\\('([^']*)'.*");
      MatchResult fileMatch = sourceExp.exec(event.getInput());
      if (fileMatch == null || fileMatch.getGroupCount() == 0)
      {
         return;
      }     
      String path = FilePathUtils.normalizePath(
View Full Code Here

      return false; // All versions of Chrome are upsupported
    }

    if (userAgent.contains("Firefox")) {
      RegExp versionRegExp = RegExp.compile("Firefox[\\/\\s](\\d+)\\.\\d+", "ig");
      MatchResult result = versionRegExp.exec(userAgent);
      if (result != null) {
        int version = Integer.parseInt(result.getGroup(1));
        return version < 7; // Resize is unsupported for Firefox 7 and newer.
      }
    }
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.