Community
    • Login

    replace function

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    49 Posts 9 Posters 52.8k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • dailD
      dail @Parpaluck
      last edited by dail

      @Parpaluck

      I banned your first account for insulting and disrespecting members of this forum multiple times. I was going to overlook the fact you created a secondary account and now you are lying about it (there is clear information in your profile about who you are).

      I would choose your words wisely if you make any more posts.

      This forum is to have civil and constructive discussions about Notepad++.

      1 Reply Last reply Reply Quote 1
      • Claudia FrankC
        Claudia Frank @Parpaluck
        last edited by

        @Parpaluck

        Why do you call me names? What does it mean, “Mr. Saliu”? Who you talkin to?

        mabye because of this.

        I clicked on your “Here” link, and I get this:

        “https://webmshare.com/m888e
        NppOnWindows10ReplaceDemo
        Error; Unsupported video type or invalid file path”

        Strange, could it be that your browser isn’t capable of running webm files?

        What is that “virtualbox”? My Windows 10 v1703 has nothing like that on my system.

        It allows me to install windows 10 under a running linux operating system.

        That Unix (LF) setting does not carry out the multiline replace in my HTML files.
        It only pastes the first line in the MULTILINE text bloc. I tried it dozens of times. I got >no idea >what kind of HTML files you got… maybe you ain’t got no HTML files at all.

        The one you said I should use (Statistical Page Pick-3 Lottery in Notepad++)

        Otherwise, you might just have pasted a single long text line in the ‘Replace with’ >textbox. The long line is displayed in “multiple lines” via ‘Word-wrap on’
        (in ‘View’ menu). That’s not what we talkin about here.
        We consider MULTILINE TEXT BLOC text that shows multiple lines even when word-wrap is set to OFF.
        Listen, if we put ego aside, we are left with facts only. The hard-cold facts have proven >far more often than not that Notepad++ does NOT support replace of TRUE multiline >text blocs via direct copy-and-paste. I work with 32-bit Notepad v7.3.3 and I don’t
        think I’ll move beyond that version. It looks a lot like cult-following. (The author should >fight against that.) Hundreds of people here, real-life webmasters, would want such a >replace function be implemented in Notepad++.

        Agreed and I assume no one wants this workaround to be in place forever but for
        the time being it might be helpful for other, if it doesn’t work for you …

        Otherwise, I’ll follow the hint by the guy you name-called “Mr. Saliu”. ‘Text Replace’ by >Ecobyte does a tremendously great job. Not to mention it has a special feature >Notepad++ will never implement: ‘Replace between ranges’ (e.g. different footers on a >website).

        Whatever makes you happy.

        Cheers
        Claudia

        1 Reply Last reply Reply Quote 0
        • ParpaluckP
          Parpaluck Banned
          last edited by

          “Agreed and I assume no one wants this workaround to be in place forever but for the time being it might be helpful for other, if it doesn’t work for you …”

          It does NOT work for any SANE user, stupidiot!

          @dail

          Go fuck yourself, skum of two screaming bitches and three krazed dawgs: One without an eye, one without an ear, one without a tail!

          You think banning factual accounts solve your madness?

          ME THINKS NOT, father muckers!

          Censorship, Ideology, Religion, Money, Piracy, Hatred, Ban

          1 Reply Last reply Reply Quote 0
          • go2toG
            go2to
            last edited by

            Claudia Frank guy038
            I concur with Parpaluck. I can’t replicate your procedure. I copied the source of two of the webpages discussed in this thread. EOL is set to Unix. The replace box accepts only the first line in the multiple lines of text. What’s the whole point here? If you knowingly post the wrong procedure, it is disrespectful of other members of this community.

            1 Reply Last reply Reply Quote 0
            • guy038G
              guy038
              last edited by guy038

              Hello, @go2to,

              Oh no, for sure ! We’re not telling lies, Claudia and I ! So, we have to find out why you cannot perform a multi-lines replacement.

              Obviously, the main point is the ability to insert a multi-lines text in the Replace with box, of the N++ Replace dialog. This case should be quite easy to verify !

              Just follow this procedure :

              • Open the N++ v7.4.1 software ( Last version )

              • Open a new empty tab ( Ctrl + N )

              • Insert, for instance, the three complete lines, below :

              abc
              def
              ghi
              
              • Click on the ¶ icon of the Tollbar OR choose the menu option View > Show Symbol > Show All Characters

              => The symbols of the Windows End of Line characters should be visible ( CR and LF ) at the end of each line

              • Then, choose the menu option Edit > EOL Conversion > Unix (LF)

              => This time, the three lines should end with the LF character, only

              • Select the block of these three lines ( => The cursor/caret should be located at beginning of line 4 )

              • Copy them in the clipboard ( Ctrl + C )

              • Now, open the Replace dialog ( Ctrl + H )

              • Paste the clipboard contents in the Replace with: box ( Ctrl + V )

              => You should notice that the inserted text is the string abcdefghi, which contains two invisible LF characters ( between letters c and d and between letters f and g ) !


              Notes :

              • If you still see the string abc, only, it looks quite weird !? We’ll have to do further investigating :-(

              • This behaviour does not depend on the present encoding of the current file ( I did tests with ANSI, UTF-8 BOM and UCS-2 LE BOM encodings )

              • It does not depend, too, on the N++ present version ( I did tests with the old N++ v5.9.8 Ansi and N++ v6.4.5 ! => No problem )

              • It does not depend, also, on the present language ( I did tests with HTML, .INI, Python, Normal text, … => No problem )

              • Finally, it doesn’t care about the Wrap state of text ( menu option View > Word wrap )

              See you later !

              Best Regards,

              guy038

              1 Reply Last reply Reply Quote 0
              • go2toG
                go2to
                last edited by

                guy038
                The webpages we discussed here have EOL conversion to Unix disabled. I can’t do that in the Edit menu. I think the pages are hosted in an Apache server. All my pages show the same Edit menu in Npp.

                Don Ho
                Do you care to comment? You are the one everybody trusts 100%. What’s the truth about this replace function? Thanks.

                1 Reply Last reply Reply Quote 0
                • guy038G
                  guy038
                  last edited by guy038

                  Hi, @go2to,

                  Did you try the exact steps of the procedure, exposed in my last post ? It should work nice !

                  An IMPORTANT precision :

                  If the option Unix (LF), in Edit > EOL Conversion, is greyed out, after opening some HTML code :

                  • Select the option Edit > EOL Conversion > Windows (CR LF), FIRST

                  • Now, you should, correctly, select the option Edit > EOL Conversion > Unix (LF) !!


                  On the other hand, I, also, did a try with the source of a Web page, from the @ion-saliu site

                  => No problem ! I was able to change this HTML text, with Unix ends of line and, therefore, able to perform, for instance, the multi-lines search/replacement, below !


                  Multi-lines text, below, placed in the Find what: box :

                       13    7 12 36 48 54  37        in draw #                               13 
                       14   16 35 37 52 54  33        in draw #                        14 
                       16   13 22 27 52 55  26        in draw #                               16 
                       17   10 25 35 38 41  23        in draw #                        17 
                       18    3 37 46 48 51  22        in draw #           18 *
                       19    9 23 47 53 55  39        in draw #                                     19 
                       20   15 17 43 44 48  29        in draw #                                     20 
                       21    3 13 35 39 40  37        in draw #     21 *
                       22    7 38 40 51 52  14        in draw #     22 *
                       23   14 25 32 48 54  10        in draw #                        23 
                       24    4 12 13 30 38  30        in draw #                                     24 
                       25   11 13 30 35 55  37        in draw #                 25 
                       27   10 37 43 50 52  14        in draw #                 27 
                       28    3 18 39 43 54  41        in draw #                 28 
                       29   15 29 38 52 53   7        in draw #                 29 
                       30    6 14 40 46 49  17        in draw #                                     30 
                       33   10 23 42 48 54   3        in draw #                                     33 
                       34    4 30 37 43 46  42        in draw #                        34 
                       35   12 15 30 46 54   1        in draw #                        35 
                       48   17 37 41 48 55  39        in draw #                                     48 
                       50    7 25 29 37 50  17        in draw #                                     50 
                       53    2 10 39 42 43  23        in draw #                                     53 
                       54    6  7 36 51 53  17        in draw #                                     54 
                       59    2 15 25 30 45  17        in draw #                                     59 
                       62    2 10 31 43 55  14        in draw #                               62 
                       68    1  3 30 31 43  36        in draw #                                     68 
                  

                  Changed into the multi-lines text, below, copied in the Replace with box :

                   Line    Any  Any  Any  Any  Any  Any       Pos  Pos  Pos  Pos  Pos  Pos
                   no.      1    2    3    4    5    PB        1    2    3    4    5    PB
                  
                      7     18   17   14   11   10   16        46   38   46   46   10   16 
                      8     7    3    11   33   22   34        46   46   46   33   22   34 
                      9     1    46   13   5    17   3         1    46   18   5    17   3 
                     10     10   1    5    2    10   27        10   46   46   46   10   27 
                     11     46   1    12   2    8    33        46   46   12   2    8    33 
                  

                  Cheers,

                  guy038

                  1 Reply Last reply Reply Quote 0
                  • go2toG
                    go2to
                    last edited by

                    guy038
                    BTW your latest procedure works correctly with a new file in Windows Npp. The problem is with files that were edited several times in several editors and also downloaded from Linux servers to Windows PCs. Npp treats the files as Unix even if they were created in Windows?

                    I tried the first Saliu page presented here. I just saw another one with the results of the Preakness race (preakness-stakes-winners.html). It has the same Unix/Windows mixed EOLs. I tried a trick. I saved the file as HTML locally. I copied the entire file to a new file. All EOL codes became Windows. So, Convert EOL to Unix was enabled, while the convert to windows was disabled. The serious problem is doing this with hundreds of webpages (open, save html, copy and paste in new Notepad++ file, then change EOL to Unix). Impractical. The original pages can’t be converted to Unix LF.

                    I was skeptical about you and Claudia Frank. No hard feelings. I saw your convoluted procedure first, then you came back with an edit, and another edit. I saw also Claudia’s screenshot on changing fonts in a document. I tried it and never worked for me.

                    The intriguing aspect here is the difference in the two boxes. The find box works as-is, with no changes in EOL codes.

                    Don Ho?

                    Claudia FrankC 1 Reply Last reply Reply Quote 0
                    • Claudia FrankC
                      Claudia Frank @go2to
                      last edited by

                      @go2to

                      I saw also Claudia’s screenshot on changing fonts in a document. I tried it and never worked for me.

                      Can you explain in detail what you did and what you expected that should happen?

                      Cheers
                      Claudia

                      1 Reply Last reply Reply Quote 0
                      • go2toG
                        go2to
                        last edited by

                        guy038
                        Your procedure works only in the open file, it can’t be applied to several files (especially on disk)! Replace in files is where the action is. I look with anticipation to see the replace box behave exactly like the find box without changes in EOL.

                        Don Ho?

                        For now, the Parpaluck procedure (\r\n) remains the only one applicable to multiple files directly on disk.

                        1 Reply Last reply Reply Quote 0
                        • guy038G
                          guy038
                          last edited by

                          Hi, @@go2to,

                          I didn’t say that this procedure was “THE” solution. Of course, It’s just an interesting work-around, which may be helpful to some of us, from time to time !

                          And I agree, with you, that this multi-lines S/R is rather difficult to run on multiples files, because each of them must be “Unix” files, before performing the S/R, in the Replace in files dialog :-((


                          If you long for a true Multi-lines S/R feature, you could add a pull request, at the address, below :

                          https://github.com/notepad-plus-plus/notepad-plus-plus/pulls

                          But, please, don’t expect a rapid reply to your request !!

                          Best Regards,

                          guy038

                          1 Reply Last reply Reply Quote 0
                          • Pouemes44P
                            Pouemes44
                            last edited by

                            thanks all for your answers
                            my english is not very good
                            i tried the link to add a pull request but it open https://github.com/notepad-plus-plus/notepad-plus-plus/compare so i dont understand what to do…
                            i have 2 others questions for s/r
                            i have noticed that when i used the s/r function it not begin at the top of the file but where i was looking in the file, it will be great if this function by default could begin by the top of the file
                            and an other question
                            it will be nice if we could know in which files, which line notepad++ did the job. in dont see how to see that when i use s/r in directories.
                            but perhaps its me who dont use well notepad++

                            1 Reply Last reply Reply Quote 0
                            • Scott SumnerS
                              Scott Sumner
                              last edited by

                              Before this thread went all crazy-nuts…

                              @Claudia-Frank said:

                              but now comes my time to shorten your eol conversion.
                              Goto Edit->EOL Conversion-> and choose the appropriate one ;-)

                              Even shorter is double-clicking the “Windows (CR LF)” area of the status bar (or whatever that area of the status bar currently says for you) and making the “appropriate” choice that appears in the 3-item menu that appears. :-D

                              1 Reply Last reply Reply Quote 1
                              • Scott SumnerS
                                Scott Sumner
                                last edited by

                                @go2to

                                The intriguing aspect here is the difference in the two boxes. The find box works as-is, with no changes in EOL codes. Don Ho?

                                Here’s the difference as I see it:

                                When a Find is invoked with a selection active, the selected text is put into the find-what box with this C++ code:

                                void FindReplaceDlg::setSearchText(TCHAR * txt2find) {
                                    ...
                                    ::SetDlgItemText(_hSelf, IDFINDWHAT, txt2find);
                                

                                the txt2find data may contain carriage-return (CR) characters; it is no problem for the SetDlgItemText() function to put those into the find-what box’s data.

                                On the other hand, there is no corresponding automatic way to get Notepad++ to put data into the replace-with box, so we have to Paste it in with Windows’ normal paste functionality. Controls like the find-what and replace-with box do not accept CR via this Windows paste functionality. Thus multiline data pasted in gets truncated just before the first CR.

                                I did a simple test with a new Visual Studio C++/MFC app, dialog-based, with a combobox dropped onto the dialog form. It, too, cannot accept any data pasted in after (and including) a CR.

                                The linefeed (LF) character presents no such difficulty to Windows’ normal paste, which we have seen in the experimentation discussed previously in this thread.

                                1 Reply Last reply Reply Quote 1
                                • go2toG
                                  go2to
                                  last edited by

                                  @Scott
                                  Still the replace box accepts \r\n in extended mode, which is CR+LF.

                                  Several other editors accept direct copy and paste in the replace-with box, be it CR+LF, LF or combination of both. They are probably written in C++. But I think it can be done in any language since CR and LF have the same codes.

                                  Don is busy now with other issues in 7.4.1. I saw there are problems with replacing again in several open files.

                                  Scott SumnerS 1 Reply Last reply Reply Quote 0
                                  • Scott SumnerS
                                    Scott Sumner @go2to
                                    last edited by

                                    @go2to

                                    Still the replace box accepts \r\n

                                    Do you mean literally \ followed by r followed by \ followed by n? If so then that’s not what I’m talking about just above. However, if you’re saying that you can get the replace-with box to accept more than one line where the line-separator has a definite CR character in it, even in Extended mode, then I’m afraid I can’t duplicate that behavior (all I get is the first line). At the time of paste, it is irrelevant which search-mode is in effect, a paste into the replace-with box is just a paste…

                                    other editors accept…they are written in C++

                                    Certainly, but that’s not relevant to the current discussion. Unless the complaint is “Other editors can do it, why not Notepad++?” To that I’d say it is just a limitation, and the C++ code could be changed in the future to remove that limitation.

                                    1 Reply Last reply Reply Quote 0
                                    • go2toG
                                      go2to
                                      last edited by

                                      @go2to said:
                                      Several other editors accept direct copy and paste in the replace-with box, be it CR+LF, LF or combination of both. They are probably written in C++. But I think it can be done in any language since CR and LF have the same codes.\r\n\r\nDon is busy now with other issues in 7.4.1. I saw there are problems with replacing again in several open files.\r\n

                                      It is now one line after deleting CR+LF and adding \r\n. Everything is pasted in the replace box.
                                      It works flawlessly in the current file, or all open files, or in find in files.

                                      1 Reply Last reply Reply Quote 0
                                      • First post
                                        Last post
                                      The Community of users of the Notepad++ text editor.
                                      Powered by NodeBB | Contributors