Package org.rstudio.core.client.regex

Examples of org.rstudio.core.client.regex.Pattern


   private String substitute(final Match match,
                             String replacement,
                             final String data)
   {
      Pattern pattern = Pattern.create("[$\\\\]([1-9][0-9]?|.)");
      return pattern.replaceAll(replacement, new ReplaceOperation()
      {
         public String replace(Match m)
         {
            char p = m.getValue().charAt(0);
            char c = m.getValue().charAt(1);
View Full Code Here


   }

   @Override
   public int getRnwOptionsStart(String line, int cursorPos)
   {
      Pattern pattern = docDisplay_.getFileType().getRnwStartPatternBegin();
      if (pattern == null)
         return -1;

      String linePart = line.substring(0, cursorPos);
      Match match = pattern.match(linePart, 0);
      if (match == null)
         return -1;

      // See if the cursor is already past the end of the chunk header,
      // for example <<foo>>=[CURSOR].
      Pattern patternEnd = docDisplay_.getFileType().getRnwStartPatternEnd();
      if (patternEnd != null && patternEnd.match(linePart, 0) != null)
         return -1;

      return match.getValue().length();
   }
View Full Code Here

      ArrayList<FileSystemItem> results = new ArrayList<FileSystemItem>();

      if (dirPath.startsWith("/"))
         results.add(FileSystemItem.createDir("/"));

      Pattern pattern = Pattern.create("[^/]+");
      Match m = pattern.match(dirPath, 0);
      while (m != null)
      {
         results.add(FileSystemItem.createDir(
               dirPath.substring(0, m.getIndex() + m.getValue().length())));
View Full Code Here

   private static int countLinesInternal(Text textNode, boolean pre)
   {
      if (!pre)
         return 0;
      String value = textNode.getData();
      Pattern pattern = Pattern.create("\\n");
      int count = 0;
      Match m = pattern.match(value, 0);
      while (m != null)
      {
         count++;
         m = m.nextMatch();
      }
View Full Code Here

      if (plainText == null || plainText.length() == 0)
         return;

      Document doc = el.getOwnerDocument();

      Pattern pattern = Pattern.create("\\n");
      int tail = 0;
      Match match = pattern.match(plainText, 0);
      while (match != null)
      {
         if (tail != match.getIndex())
         {
            String line = plainText.substring(tail, match.getIndex());
View Full Code Here

   public String getRequestMethodName()
   {
      if (requestData_.equals("[REDACTED]"))
         return requestData_;

      Pattern p = Pattern.create("\\\"method\\\":\\s*\\\"([^\"]+)\\\"");
      Match match = p.match(requestData_, 0);
      if (match == null)
         return null;
      return match.getGroup(1);
   }
View Full Code Here

      {
         return null;
      }
      else
      {
         Pattern p = Pattern.create("\\(\\*(\\.[^)]*)\\)$");
         Match m = p.match(filter, 0);
         if (m == null)
            return null;
         else
            return m.getGroup(1);
      }
View Full Code Here

         // if this query is a further refinement of a non-overflowed
         // previous query then satisfy it by filtering the previous results
         if (!res.getMoreAvailable() &&
             request.getQuery().startsWith(res.getQuery()))
         {
            Pattern pattern = null;
            final String queryLower = request.getQuery().toLowerCase();
            if (queryLower.indexOf('*') != -1)
               pattern = patternForTerm(queryLower);
           
            ArrayList<CodeSearchSuggestion> suggestions =
                                       new ArrayList<CodeSearchSuggestion>();
            for (int s=0; s<res.getSuggestions().size(); s++)
            {
               CodeSearchSuggestion sugg = res.getSuggestions().get(s);
              
               String name = sugg.getMatchedString().toLowerCase();
               if (pattern != null)
               {
                  Match match = pattern.match(name, 0);
                  if (match != null && match.getIndex() == 0)
                     suggestions.add(sugg);
               }
               else
               {
View Full Code Here

TOP

Related Classes of org.rstudio.core.client.regex.Pattern

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.