Menu

Very Slow Replacement in Column Selections

2008-04-26
2012-11-13
  • Sergey Skvortsov

    Huge problem found in 4.8.5 and 4.8.2 (earlier versions were not tested)
    Replacement in vertical blocks selections is very slow. It seems to me that speed decreases a lot more than number of lines in selection.
    There is no problem with couple of hundreds lines, but several thousands hold Notepad++ forever.
    It is imposssibe to use it to replace in big vertical column selections.

    Can somebody help to resolve the problem

     
    • Sergey Skvortsov

      It also take several minutes to remove vertical block selection which contains couple thousands lines(after press delete key). Why it is so slow??? I had no such problems with ConTEXT.

       
      • Fool4UAnyway

        Fool4UAnyway - 2008-04-26
         
        • Fool4UAnyway

          Fool4UAnyway - 2008-04-26

          You may also be interested in these messages, search results for "+column +range":

          http://sourceforge.net/search/?words=%2Bcolumn+%2Brange&sort=posted_date&sortdir=desc&offset=0&group_id=95717&forum_id=331753&type_of_search=forums&pmode=0&limit=25

          Take a look here for an alternative way to do column block selection replacement, but think of the possible impact of using this method:

          "[featutre Request] column selecting"
          http://sourceforge.net/forum/forum.php?thread_id=1877271&forum_id=331753

          Perhaps you can even get your desired results by doing a regular expression replacement on full lines, by accounting for the number of characters before and after the column range to be changed (or to be deleted) by using TextCrawler.

          "Tools to find and copy regex matches in files" (New)
          By: Fool4UAnyway (fool4uanyway) - 2008-04-20 01:49
          http://sourceforge.net/forum/message.php?msg_id=4915704

          in the thread

          "copy to clip all text matching regex pattern" (Help forum)
          http://sourceforge.net/forum/forum.php?thread_id=2012623&forum_id=331754 

          dealing with the question how to extract only all matches instead of complete lines.

          I didn't check, but I assume you can simply perform a search for
          "
          (# number of characters from the beginning of the line)
          (# number of characters to be changed)
          (perhaps anyting else like a regex that marks the end of the part to be changed)
          "
          and replace that by putting back the front and the end and the desired columns in-between:
          "
          \1
          here's what you want to get
          \3
          "

          Put the regex on one line. I just cut it into three lines and grouped all expressions to clarify the idea.

           
          • Fool4UAnyway

            Fool4UAnyway - 2008-04-26

            So, if you want to delete the columns 30-50 the Find and Replace fields would have something like this:

            Find field:
            ^(.{29})(.{21})(.*$)
            Replace field:
            \1\3

            Or, if you don't (want to) group the second column range (there is no need to):

            Find field:
            ^(.{29}).{21}(.*$)
            Replace field:
            \1\2

             
            • Fool4UAnyway

              Fool4UAnyway - 2008-04-28

              The replace regex was for use with TextCrawler. I hope that was clear.

              However, in TextClawler grouped expressions are referred to by a $ sign + their number.
              Here are the correct replace terms.

              So, if you want to delete the columns 30-50 the Find and Replace fields would have something like this:

              Find field:
              ^(.{29})(.{21})(.*$)
              Replace field:
              $1$3

              Or, if you don't (want to) group the second column range (there is no need to):

              Find field:
              ^(.{29}).{21}(.*$)
              Replace field:
              $1$2

              If you have tab separated columns, your expression may have to be more complex to account for varying character width of column field data. But you can probably use the tab character as a separator then, perhaps even allowing something like "(\.\t){3}". I didn't check this, however.

               
            • Nobody/Anonymous

              fool4uanyway, thank you
              It is really more than i need. I never thought about using regular expressions this way.