How to replace only text in a selected column











up vote
1
down vote

favorite












When I select some text in a column, replace/in selection will become grey.
How can I replace text only within a column of selected text in Notepad++?










share|improve this question
























  • I can only replace column selected text by first column select and cut, then paste cut text to new lines, then select thos text and replace, then cut and paste to the original place. It's not easy.
    – Fisher
    Mar 20 '15 at 18:33










  • How are your columns delimited? Tabs?
    – Excellll
    Mar 26 '15 at 20:36










  • Columns are selected by ctrl+alt+left-click.
    – Fisher
    Mar 27 '15 at 10:41






  • 1




    Hi, that's not what I asked. In your file, what character(s) are in between columns? Is it a tab? Several spaces? This is important because the best workaround I see is to use regular expressions to search and replace in a way that doesn't require you to select down a column.
    – Excellll
    Mar 27 '15 at 14:31










  • Yes, I know. But it doesn't matter. Suppose it's just just a big chunk of random text, it doesn't have to be any "column" at all. :)
    – Fisher
    Mar 28 '15 at 4:12















up vote
1
down vote

favorite












When I select some text in a column, replace/in selection will become grey.
How can I replace text only within a column of selected text in Notepad++?










share|improve this question
























  • I can only replace column selected text by first column select and cut, then paste cut text to new lines, then select thos text and replace, then cut and paste to the original place. It's not easy.
    – Fisher
    Mar 20 '15 at 18:33










  • How are your columns delimited? Tabs?
    – Excellll
    Mar 26 '15 at 20:36










  • Columns are selected by ctrl+alt+left-click.
    – Fisher
    Mar 27 '15 at 10:41






  • 1




    Hi, that's not what I asked. In your file, what character(s) are in between columns? Is it a tab? Several spaces? This is important because the best workaround I see is to use regular expressions to search and replace in a way that doesn't require you to select down a column.
    – Excellll
    Mar 27 '15 at 14:31










  • Yes, I know. But it doesn't matter. Suppose it's just just a big chunk of random text, it doesn't have to be any "column" at all. :)
    – Fisher
    Mar 28 '15 at 4:12













up vote
1
down vote

favorite









up vote
1
down vote

favorite











When I select some text in a column, replace/in selection will become grey.
How can I replace text only within a column of selected text in Notepad++?










share|improve this question















When I select some text in a column, replace/in selection will become grey.
How can I replace text only within a column of selected text in Notepad++?







notepad++ find-and-replace






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 '15 at 20:35









Excellll

11k74162




11k74162










asked Mar 20 '15 at 18:24









Fisher

154229




154229












  • I can only replace column selected text by first column select and cut, then paste cut text to new lines, then select thos text and replace, then cut and paste to the original place. It's not easy.
    – Fisher
    Mar 20 '15 at 18:33










  • How are your columns delimited? Tabs?
    – Excellll
    Mar 26 '15 at 20:36










  • Columns are selected by ctrl+alt+left-click.
    – Fisher
    Mar 27 '15 at 10:41






  • 1




    Hi, that's not what I asked. In your file, what character(s) are in between columns? Is it a tab? Several spaces? This is important because the best workaround I see is to use regular expressions to search and replace in a way that doesn't require you to select down a column.
    – Excellll
    Mar 27 '15 at 14:31










  • Yes, I know. But it doesn't matter. Suppose it's just just a big chunk of random text, it doesn't have to be any "column" at all. :)
    – Fisher
    Mar 28 '15 at 4:12


















  • I can only replace column selected text by first column select and cut, then paste cut text to new lines, then select thos text and replace, then cut and paste to the original place. It's not easy.
    – Fisher
    Mar 20 '15 at 18:33










  • How are your columns delimited? Tabs?
    – Excellll
    Mar 26 '15 at 20:36










  • Columns are selected by ctrl+alt+left-click.
    – Fisher
    Mar 27 '15 at 10:41






  • 1




    Hi, that's not what I asked. In your file, what character(s) are in between columns? Is it a tab? Several spaces? This is important because the best workaround I see is to use regular expressions to search and replace in a way that doesn't require you to select down a column.
    – Excellll
    Mar 27 '15 at 14:31










  • Yes, I know. But it doesn't matter. Suppose it's just just a big chunk of random text, it doesn't have to be any "column" at all. :)
    – Fisher
    Mar 28 '15 at 4:12
















I can only replace column selected text by first column select and cut, then paste cut text to new lines, then select thos text and replace, then cut and paste to the original place. It's not easy.
– Fisher
Mar 20 '15 at 18:33




I can only replace column selected text by first column select and cut, then paste cut text to new lines, then select thos text and replace, then cut and paste to the original place. It's not easy.
– Fisher
Mar 20 '15 at 18:33












How are your columns delimited? Tabs?
– Excellll
Mar 26 '15 at 20:36




How are your columns delimited? Tabs?
– Excellll
Mar 26 '15 at 20:36












Columns are selected by ctrl+alt+left-click.
– Fisher
Mar 27 '15 at 10:41




Columns are selected by ctrl+alt+left-click.
– Fisher
Mar 27 '15 at 10:41




1




1




Hi, that's not what I asked. In your file, what character(s) are in between columns? Is it a tab? Several spaces? This is important because the best workaround I see is to use regular expressions to search and replace in a way that doesn't require you to select down a column.
– Excellll
Mar 27 '15 at 14:31




Hi, that's not what I asked. In your file, what character(s) are in between columns? Is it a tab? Several spaces? This is important because the best workaround I see is to use regular expressions to search and replace in a way that doesn't require you to select down a column.
– Excellll
Mar 27 '15 at 14:31












Yes, I know. But it doesn't matter. Suppose it's just just a big chunk of random text, it doesn't have to be any "column" at all. :)
– Fisher
Mar 28 '15 at 4:12




Yes, I know. But it doesn't matter. Suppose it's just just a big chunk of random text, it doesn't have to be any "column" at all. :)
– Fisher
Mar 28 '15 at 4:12










2 Answers
2






active

oldest

votes

















up vote
0
down vote













This is an annoying limitation of notepad++, but there are a couple of ways to solve this problem. First, if you know the column limitations that you want to replace any occurrences of the word "dog" with "cat" within columns 4 and 10, then do this:



RE search string: ^(.{3})(.{0,3})dog(.{0,3})(.*)$



RE replacement string: 12cat34



To break this down:



^          - Must match from the beginning of the line
(.{3}) - match any three characters from the line
(.{0,3}) - match 0-3 characters from the line
dog - match "dog"
(.{0,3}) - match 0-3 characters from the line
(.*) - match everything else
$ - up to the end of the line


Caveats to this approach
First, make sure you have . matches n unchecked, this would mess it up.
Mixing tabs and spaces won't work, since regular expressions see tabs as just single characters.



Another solution that will work with mixed tabs and spaces
Column select the last column you want to search in. Then type a character that isn't otherwise in the file, for example '|' or '!'.



Column select the first column you want to search in. Do the same thing as before (it can be the same character or a different one).



Now, search for your text within those boundaries.



RE search string: |(.*)dog(.*)|



RE replacement string: |1cat2|



You want to leave your marker characters since you will probably not match every line in your file and you'll want to remove all of them in a second step (either with column select and delete, or with another search/replace).






share|improve this answer






























    up vote
    -2
    down vote













    I use the Find/Replace dialog that is presented when you enter Ctrl-r. In the Find/Replace dialog there is a field to enter column numbers. This allows you limit the the Find/Replace to these columns in the file. Normal and regular expression Find/Replace are supported. I could not find how to do this Find/Replace via the Ctrl-h dialog.



    enter image description here
    Find/Replace dialog (Ctrl-r)






    share|improve this answer























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "3"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f892022%2fhow-to-replace-only-text-in-a-selected-column%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      0
      down vote













      This is an annoying limitation of notepad++, but there are a couple of ways to solve this problem. First, if you know the column limitations that you want to replace any occurrences of the word "dog" with "cat" within columns 4 and 10, then do this:



      RE search string: ^(.{3})(.{0,3})dog(.{0,3})(.*)$



      RE replacement string: 12cat34



      To break this down:



      ^          - Must match from the beginning of the line
      (.{3}) - match any three characters from the line
      (.{0,3}) - match 0-3 characters from the line
      dog - match "dog"
      (.{0,3}) - match 0-3 characters from the line
      (.*) - match everything else
      $ - up to the end of the line


      Caveats to this approach
      First, make sure you have . matches n unchecked, this would mess it up.
      Mixing tabs and spaces won't work, since regular expressions see tabs as just single characters.



      Another solution that will work with mixed tabs and spaces
      Column select the last column you want to search in. Then type a character that isn't otherwise in the file, for example '|' or '!'.



      Column select the first column you want to search in. Do the same thing as before (it can be the same character or a different one).



      Now, search for your text within those boundaries.



      RE search string: |(.*)dog(.*)|



      RE replacement string: |1cat2|



      You want to leave your marker characters since you will probably not match every line in your file and you'll want to remove all of them in a second step (either with column select and delete, or with another search/replace).






      share|improve this answer



























        up vote
        0
        down vote













        This is an annoying limitation of notepad++, but there are a couple of ways to solve this problem. First, if you know the column limitations that you want to replace any occurrences of the word "dog" with "cat" within columns 4 and 10, then do this:



        RE search string: ^(.{3})(.{0,3})dog(.{0,3})(.*)$



        RE replacement string: 12cat34



        To break this down:



        ^          - Must match from the beginning of the line
        (.{3}) - match any three characters from the line
        (.{0,3}) - match 0-3 characters from the line
        dog - match "dog"
        (.{0,3}) - match 0-3 characters from the line
        (.*) - match everything else
        $ - up to the end of the line


        Caveats to this approach
        First, make sure you have . matches n unchecked, this would mess it up.
        Mixing tabs and spaces won't work, since regular expressions see tabs as just single characters.



        Another solution that will work with mixed tabs and spaces
        Column select the last column you want to search in. Then type a character that isn't otherwise in the file, for example '|' or '!'.



        Column select the first column you want to search in. Do the same thing as before (it can be the same character or a different one).



        Now, search for your text within those boundaries.



        RE search string: |(.*)dog(.*)|



        RE replacement string: |1cat2|



        You want to leave your marker characters since you will probably not match every line in your file and you'll want to remove all of them in a second step (either with column select and delete, or with another search/replace).






        share|improve this answer

























          up vote
          0
          down vote










          up vote
          0
          down vote









          This is an annoying limitation of notepad++, but there are a couple of ways to solve this problem. First, if you know the column limitations that you want to replace any occurrences of the word "dog" with "cat" within columns 4 and 10, then do this:



          RE search string: ^(.{3})(.{0,3})dog(.{0,3})(.*)$



          RE replacement string: 12cat34



          To break this down:



          ^          - Must match from the beginning of the line
          (.{3}) - match any three characters from the line
          (.{0,3}) - match 0-3 characters from the line
          dog - match "dog"
          (.{0,3}) - match 0-3 characters from the line
          (.*) - match everything else
          $ - up to the end of the line


          Caveats to this approach
          First, make sure you have . matches n unchecked, this would mess it up.
          Mixing tabs and spaces won't work, since regular expressions see tabs as just single characters.



          Another solution that will work with mixed tabs and spaces
          Column select the last column you want to search in. Then type a character that isn't otherwise in the file, for example '|' or '!'.



          Column select the first column you want to search in. Do the same thing as before (it can be the same character or a different one).



          Now, search for your text within those boundaries.



          RE search string: |(.*)dog(.*)|



          RE replacement string: |1cat2|



          You want to leave your marker characters since you will probably not match every line in your file and you'll want to remove all of them in a second step (either with column select and delete, or with another search/replace).






          share|improve this answer














          This is an annoying limitation of notepad++, but there are a couple of ways to solve this problem. First, if you know the column limitations that you want to replace any occurrences of the word "dog" with "cat" within columns 4 and 10, then do this:



          RE search string: ^(.{3})(.{0,3})dog(.{0,3})(.*)$



          RE replacement string: 12cat34



          To break this down:



          ^          - Must match from the beginning of the line
          (.{3}) - match any three characters from the line
          (.{0,3}) - match 0-3 characters from the line
          dog - match "dog"
          (.{0,3}) - match 0-3 characters from the line
          (.*) - match everything else
          $ - up to the end of the line


          Caveats to this approach
          First, make sure you have . matches n unchecked, this would mess it up.
          Mixing tabs and spaces won't work, since regular expressions see tabs as just single characters.



          Another solution that will work with mixed tabs and spaces
          Column select the last column you want to search in. Then type a character that isn't otherwise in the file, for example '|' or '!'.



          Column select the first column you want to search in. Do the same thing as before (it can be the same character or a different one).



          Now, search for your text within those boundaries.



          RE search string: |(.*)dog(.*)|



          RE replacement string: |1cat2|



          You want to leave your marker characters since you will probably not match every line in your file and you'll want to remove all of them in a second step (either with column select and delete, or with another search/replace).







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Aug 21 '17 at 12:00









          Toto

          3,38091126




          3,38091126










          answered Aug 28 '15 at 19:37









          Scott Gartner

          1713




          1713
























              up vote
              -2
              down vote













              I use the Find/Replace dialog that is presented when you enter Ctrl-r. In the Find/Replace dialog there is a field to enter column numbers. This allows you limit the the Find/Replace to these columns in the file. Normal and regular expression Find/Replace are supported. I could not find how to do this Find/Replace via the Ctrl-h dialog.



              enter image description here
              Find/Replace dialog (Ctrl-r)






              share|improve this answer



























                up vote
                -2
                down vote













                I use the Find/Replace dialog that is presented when you enter Ctrl-r. In the Find/Replace dialog there is a field to enter column numbers. This allows you limit the the Find/Replace to these columns in the file. Normal and regular expression Find/Replace are supported. I could not find how to do this Find/Replace via the Ctrl-h dialog.



                enter image description here
                Find/Replace dialog (Ctrl-r)






                share|improve this answer

























                  up vote
                  -2
                  down vote










                  up vote
                  -2
                  down vote









                  I use the Find/Replace dialog that is presented when you enter Ctrl-r. In the Find/Replace dialog there is a field to enter column numbers. This allows you limit the the Find/Replace to these columns in the file. Normal and regular expression Find/Replace are supported. I could not find how to do this Find/Replace via the Ctrl-h dialog.



                  enter image description here
                  Find/Replace dialog (Ctrl-r)






                  share|improve this answer














                  I use the Find/Replace dialog that is presented when you enter Ctrl-r. In the Find/Replace dialog there is a field to enter column numbers. This allows you limit the the Find/Replace to these columns in the file. Normal and regular expression Find/Replace are supported. I could not find how to do this Find/Replace via the Ctrl-h dialog.



                  enter image description here
                  Find/Replace dialog (Ctrl-r)







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Feb 27 '16 at 14:47









                  karel

                  9,17793138




                  9,17793138










                  answered Feb 27 '16 at 14:34









                  GordyCA

                  1




                  1






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Super User!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f892022%2fhow-to-replace-only-text-in-a-selected-column%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

                      Alcedinidae

                      Origin of the phrase “under your belt”?