Package org.rstudio.core.client.regex.Pattern

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


      // NOTE: the 4 spaces comes from the implementation of printtab2buff
      // in deparse.c -- it is hard-coded to use 4 spaces for the first 4
      // levels of indentation and then 2 spaces for subsequent levels.
      final String replaceWith = replaceText;
      Pattern pattern = Pattern.create("^(    ){1,4}");
      code = pattern.replaceAll(code, new ReplaceOperation()
      {
         @Override
         public String replace(Match m)
         {
            return m.getValue().replace("    ", replaceWith);
         }
      });
      Pattern pattern2 = Pattern.create("^\t{4}(  )+");
      code = pattern2.replaceAll(code, new ReplaceOperation()
      {
         @Override
         public String replace(Match m)
         {
            return m.getValue().replace("  ",  replaceWith);
View Full Code Here


      }

      public String getSweaveChunkText(final Scope chunk, Range range)
      {
         String text = docDisplay_.getCode(range.getStart(), range.getEnd());
         return Pattern.create("^<<(.*?)>>.*").replaceAll(text, new ReplaceOperation()
         {
            @Override
            public String replace(Match m)
            {
               String label = m.getGroup(1).trim();
View Full Code Here

   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

   }

   public static String pathToTitle(String path)
   {
      String val = FileSystemItem.createFile(path).getStem();
      val = Pattern.create("\\b[a-z]").replaceAll(val, new ReplaceOperation()
      {
         @Override
         public String replace(Match m)
         {
            return m.getValue().toUpperCase();
View Full Code Here

      return label.replace("_", "__");
   }

   public static String replaceMnemonics(String label, final String replacement)
   {
      return Pattern.create("_(_?)").replaceAll(label, new ReplaceOperation()
      {
         public String replace(Match m)
         {
            if (m.getGroup(1).length() > 0)
               return "_";
View Full Code Here

TOP

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

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.