replace function
-
@Claudia Frank:
There is something strange about you, axiomatico. Methinks you cook the books. Or, perhaps your version of Notepad++ is special and not available to programmers like me.
I did it again. Once again, the procedure didn’t work in my Notepad++ neck-of-the-woods. The replace box only copies the first line in the bloc. I used the ‘Edit’ menu and also the contextual menu (right-click). Look again at the screenshot:
Extended Search/Replace in Notepad++ClaudiaCheat
So, what you did: Cook the books. You created just one paragraph in a narrow screen with ‘Word-wrap on’. Why don’t you do on a page I know? Download this page from my website, open page source, copy-and-paste the content to a new Notepad++ file. Apply your procedure and show us a real screenshot.
The page is a little more complicated as it has ‘pre’ sections that show different fonts.
Statistical Page Pick-3 Lottery in Notepad++
If not, you have a serious behavioral problem (@Scott Sumner nods approvingly). Notepad++ is not served by fabricating things.
Ion Saliu
“A good man is an axiomatic man; an axiomatic man is a happy man. Be axiomatic!” -
Could it be that it is related to Unix? I’m running npp on ubuntu.
Would you give it a try to convert eols to unix and redo the test?What about my question? Do you wanna answer it or do you prefer to keep insulting me?
Cheers
Claudia -
Axiomatic Ones:
Maybe there is another scenario in play here. Maybe this multiline replace function WAS present in a previous version of Notepad++. Obviously, I didn’t check every version regarding this replace function. Was it really present in a previous versions? Was the function dropped consciously (e.g. for copyright reasons) or inadvertently?
Methinks it might be an overlooked property setting. Visual Basic has a property setting for the textbox: ‘Multiline = True’. Look at that under the property sheet of ‘Replace textbox’.
Now, this hyper active Claudia Frank maybe works with a previous version of Notepad++ that featured the multiline replace. She should have been honest and tell us what version of Notepad she used. She just posted that actually she works with a Linux version of Notepad++. Scott Sumner and I disclosed the versions we are using.
I run 32-bit Notepad++ on 64-bit Windows 10.
Now, I put the blame squarely on the author of this excellent editor. This replace thingy has been debated a lot — I mean, a lot. There are several threads with hundreds of posts in this very community. Why does the author hide in silence? He knows better than anybody else if the feature we are debating here IS PRESENT OR NOT IN NOTEPAD++. Just a few paragraphs will do. Posts by Claudia Frank won’t do. She is disingenuous. She cooks the books, even by Photoshopping…
Ion Saliu
“A good man is an axiomatic man; an axiomatic man is a happy man. Be axiomatic!” -
Claudia, why in the animated GIF when you right-click on the replace-with box does the popup menu appear so much different than mine? I can’t quite read yours in the graphic (too small, too fast) but it is definitely “different” and I don’t know why that would be…some side effect of running under Wine?
Anyway, Claudia, your last hint has solved the mystery of why this works for you and not me or Ion…Linux line-endings!! If I try to duplicate your procedure on text with LF only as the line-ending it works for me as it does for you (allows multiple lines in the replace-with box)…same test with CR+LF as line-ending fails (only puts first line of multiline select block in the replace-with box) as previously reported.
I thought it was pretty clear that my hint about “fakery” (“maybe Claudia IS faking screenshots”) was all in jest…that’s why I followed that with a :-D… If that was misinterpreted then I cannot apologize enough. However, if Ion is also jesting, he has taken it to a totally different level and personally I don’t find that warranted or acceptable. As Jim stated earlier, Claudia’s inputs to this community are invaluable, and when she disappears for a period of time (as she tends to do sometimes) she is sorely missed here. She always signs with “Cheers” but the real CHEERS go to Claudia!
And Ion, please don’t “nod my head approvingly” on my behalf–I can do that for myself if need be. :)
-
@Scott Sumner
Axiomatic One:
Claudia Frank does “fake the stake”. You wasn’t jesting about it. Look at her reply in another thread. She FAKES on-the-fly font changing in Notepad++, much like in Microsoft Word. That is NOT a real feature in Notepad++. She Photoshopped the screenshot:
https://notepad-plus-plus.org/community/topic/13829/improments-about-notepad-font
As for the animated image, methinks she also “faked the stake” or “cooked the books”. There was a bloc of empty space in a Notepad++ file. One can type text and presses the down arrow to create the impression of multiple lines. They ain’t real lines, but part of a single paragraph.
I did the following experiment in the same HTML file I used in my first screenshot. I selected a paragraph that consists of several lines. But those are NOT real lines. The appearance of multiple lines is created by word-wrap on.
Search/Replace in Notepad++SingleWrappedLine
What many posters in this community want is REPLACE OF MULTIPLE REAL LINES, NOT SINGLE LONG LINES. That’s why we are in this thread and several other threads on the same topic.
Again, I put the blame squarely on the author of this excellent editor. This replace thingy has been debated a lot — I mean, a lot. There are several threads with hundreds of posts in this very community. Why does the author hide in silence? He knows better than anybody else if the feature we are debating here IS PRESENT OR NOT IN NOTEPAD++. Just a few paragraphs will do. Posts by Claudia Frank won’t do. She is disingenuous. She cooks the books, even by Photoshopping. For what? For NO reason, because she has a problem, she is not a reasonable person. It makes people waste their time reading her posts, taking her procedures at face value, when, in fact, she fakes the stakes…
Ion Saliu
“A good man is an axiomatic man; an axiomatic man is a happy man. Be axiomatic!” -
Hi Scott,
Claudia, why in the animated GIF when you right-click on the replace-with box does the popup menu appear so much different than mine?
actually I don’t know - I once played with the different ui languages and now I do have
a German context menu but only in dialogs (it looks like). The context menu of the editor
is still English.I thought it was pretty clear that my hint about “fakery” … was all in jest
To me it was :-)
However, if Ion is also jesting…
I don’t think so, but not worth to worry about.
Not sure if I find the time to check why the two fields in the dialog
are handled differently but … let’s see.Cheers
Claudia -
@Claudia-Frank said:
why the two fields in the dialog are handled differently
I guess there are FOUR real differences:
- Find-what box with Windows line endings between lines
- Find-what box with Linux line endings between lines
- Replace-with box with Windows line endings between lines <-- the true troublesome one
- Replace-with box with Linux line endings between lines
-
it was not easy for me to succeed too, sometimes i succeed other time i dont succeed, perhaps its because of me i dont know
but notepad++ is a great tool hope it could be a next developement to make this more easy -
Hello, @kat75, @scott-sumner, @claudia-frank, @jim-dailey, @ion-Saliu and All,
First of all, I totally agree to what Scott and Jim said : the Claudia’s contribution to our forum, is really awesome, in a huge lot of domains ! Congratulations for your global insight on technical problems and your inexhaustible availability to all of us !!
And…, @ion-Saliu, no doubt : you certainly have an ego much greater than Donald Trump’s one ! You should have followed that forum, for some time, to realize that you’re just saying stupidities and discourteous things about Claudia. And, when you say :
It makes people waste their time reading her posts, taking her procedures at face value, when, in fact, she fakes the stakes…
I simply think, on the contrary, that we’re just wasting our time reading yours ! Indeed, change your attitude ! If not, as one of the moderators of that site, I could take the responsibility to delete some of your posts…
Well, now, let’s go back to an interesting topic : the last Claudia’s discovery !!
Oh ! A THOUSAND thanks, Claudia, for finding out the solution to paste multi-lines in the Replace dialog :-)))
I did some tests, and AFAIK, it happens that :
- Any range of lines, copied, in the Find box, whatever the End of Line character(s) of each line, of that block, will be searched, exactly, with the same line endings. That is to say, for instance, that the text, below :
123
CR LF
456LF
789CR
copied in the Find what: box, will not find this other multi-lines text below :
123
CR
456CR LF
789LF
-
Any range of lines, copied, in the Replace with: box, with the Unix end of line LF,
exclusively
, (\n
) will replace all the searched text, either mono or multi lines ! -
It does not depend, too, on the Search mode (
Normal
,Extended
, orRegular expression
) However, to avoid unpredictable results, it seems sensible to use, preferably, the Normal search mode. -
Moreover, beware to always leave the Match whole word only option UNCHECKED, if Normal or Extended mode is set !
-
IMPORTANT : The Find what: and Replace with: boxes may contain a maximum of 2046 characters. So, once a block of lines selected, either for the Search or the Replace part, just have a glance, at the status bar, to know the size of the selection !
Practically, in Windows files :
UPDATE : Just forget the procedure, below, and jump to my other post, where I propose a more simple method, indeed !
https://notepad-plus-plus.org/community/topic/13823/replace-function/29
-
Firstly, change your Replace block of Windows lines into a block of Unix lines :
-
Do a normal selection of your Replace block of lines ( Remember : not more than 2046 characters ! )
-
Open the Replace dialog (
Ctrl + H
) -
Type
\R
in the Find what: box -
Type
\n
, in the Replace with: box -
Check the In selection option ( IMPORTANT )
-
Select the Regular expression search mode ( IMPORTANT )
-
Click on the Replace All button
-
Close the Replace dialog
-
-
Do a normal selection of your Search block of Windows lines ( Remember : not more than 2046 characters ! )
-
Open, again, the Replace dialog (
Ctrl + H
)
=> The searched block is automatically inserted, in the Find what: box
-
Select and copy your block of Unix lines, which will replace the searched text (
CTRL + C
) -
Paste this block, in the Replace with: box (
Ctrl + V
) -
Choose, preferably, the Normal search mode
-
Uncheck the Match whole word only option ( IMPORTANT )
-
Check/Uncheck the Match case ans Wrap around options, as you want
-
Click, once or several times, on the Replace button or once, only, on the Replace All button
=> The Replace blocks should have replaced the Search blocks :-))
To end with, we have to change all the unique Unix LF characters,
\n
, in Replace blocks, by the classical Windows End of Line characters (\r\n
)-
Open, again, the Replace dialog (
Ctrl + H
) -
Type the regex
(?<!\r)\n|\r(?!\n)
, in the Find what: box -
Type the regex
\r\n
, in the Replace with: box -
Click on the Wrap around option
-
Select the Regular expression search mode
-
Click on the Replace All button
Et voilà !!
Notes
-
In this last S/R, we look for, either :
-
A LF character (
\n
), not preceded by a CR character -
A CR characte (
\r
), not followed by a LF character
-
-
And, in replacement, we change this unique End of Line character, by the two Windows line break characters (
\r\n
)
Best Regards,
guy038
-
Hi Guy,
as usual great info.
I didn’t thought I get the chance, but now comes my time to shorten your eol conversion.
Goto Edit->EOL Conversion-> and choose the appropriate one ;-)Cheers
Claudia -
You and Claudia Frank are minitrumps: Delusional. Look how Claudia Frank fabricates features in Notepad++ by Photoshopping screenshots to make-believe they are for real!
https://notepad-plus-plus.org/community/topic/13829/improments-about-notepad-font
Then she Photoshopped that animated gig where she pressed the down-arrow pretending it was the Enter key!
You are hallucinating too. The global replace in Notepad++ does NOT work via copy-and-paste. That’s the reason this thread was opened. That’s the reason why other threads on the same topic were started, including mine:
https://notepad-plus-plus.org/community/topic/13808/search-replace-of-multiline-text-blocs
So, who’s wasting other members’ time? The likes of you, Guitser, and Claudia Frank, that’s who! Why keep fantasizing that find/replace works via copy-and-paste in Notepad++? I understand early in the game, when we just wondered honestly. Now we know the feature does NOT work as we would like to. I heard the feature worked that way in an earlier version of Notepad++. I can’t attest to that. Every time I tried, the replace function did not work by simply copying-and-pasting, without the extended codes.
As for your “procedure” — that’s overkill! There is a much simpler (and SANER!) solution. It only requires a simple edit of the text to be placed (pasted) in the ‘Replace with’ textbox. Again, resorting to regex is overkill!
And, again, we all here wanted the procedure to work simply by copying-and-pasting in both textboxes.
To the author –
Methinks the problem is caused by the different settings in the ‘Find what’ textbox versus the ‘Replace with’ textbox. Since you work with Windows API, I can tell (from my experience in Visual Basic) that the textbox control has as default ‘Multiline = False’. Maybe you forgot to set property in ‘Replace with’ textbox ‘Multiline = true’. A textbox is a textbox is a textbox. Why should two instances behave differently, unless a setting is different?!Ion Saliu
“A good man is an axiomatic man; an axiomatic man is a happy man. Be axiomatic!” -
Hi All,
My method, related in my last post, for doing a multi-lines search, followed by a multi-lines replacement, in “Windows” files is, finally, more complicated than it should be. I suppose that it’s because I wrote that post, quite late, yesterday evening !
Today, it just appears to me, that the obvious method is, simply :
-
Open your “Windows” file
-
Change it, into an “Unix” file, with the menu option Edit > EOL Conversion > Unix (LF)
-
Do an normal selection of the multi-lines Search text to look for
-
Open the Replace dialog (
CTRL + H
)
=> The Search block is automatically inserted, in the Find what: box
-
Do a normal selection, too, of your multi-lines Replacement text
-
Copy that selection in the clipboard (
Ctrl + C
) -
Paste this Replacement block in the Replace with: box (
Ctrl + V
) -
Choose, preferably, the Normal search mode
-
Uncheck the Match whole word only option ( IMPORTANT )
-
Check/Uncheck the Match case ans Wrap around options, as you want
-
Click, once or several times, on the Replace button or once, only, on the Replace All button
=> The Replacement blocks should have replaced all the Search blocks :-))
-
Finally, go back to the original state of your document, performing the menu option Edit > EOL Conversion > Windows (CR LF)
-
Save your modified file
This way is more coherent, isn’t it ?
Cheers,
guy038
P.S. :
On 05/21, I added a link for a multi-lines replacement of a multi-lines text, in an HTML file, generated by @claudia-frank, with Npp++ v7.3.3, on a Windows 10 operating system. Thanks, Claudia, for this demonstration !
It shows the simplified procedure, to do these “specific” search/replacement, as I mentioned, above !
-
-
Your procedure doesn’t work with my HTML files. They were created in a dedicated HTML editor, Windows OS, various versions beginning Windows 2000. The ‘EOL Conversion’ is grayed out for Unix (LF).
Search/Replace in Notepad++EOLConversion
That being said, I found an easier procedure to replace multiline text in Notepad++, ‘Extended’.
-
Select the multiline bloc to be replaced. Press Ctrl+H; the ‘Find what’ textbox is populated automatically.
-
Copy the multiline text to replace with; e.g.
<UL>
<li> <i><b>layers of data analysis</b></i> as in the mainstream <font color=“#FF0000”><b>LotWon</b></font> software - <b>frequency groups</b> only;
<li> <i><b>the skips reports show correctly for analyses greater than 1000 past drawings - yes, lotto numbers can skip sometimes over 1000 draws in the same position!</b></i>
<li> June – September 2016 — Total winnings pick-4: $5,000 * 8 = $40,000. <i>ROI</i> (return on investment): 1724%. This must be the most efficient lottery strategy in history!
<li> <u>The best way to apply this <b>super lottery strategy</b>:</u> Instead of playing the strategy one at a time (layer by layer), play the strategies for all 6 layers <u>at the same time</u>.
</UL>-
Open a new Notepad++ file (Ctrl+N).
-
Next, write the Windows EOL codes:
\r\n -
Recopy the text to replace with and paste it; copy \r\n; paste \r\n at the end of each true line:
<UL>\r\n
<li> <i><b>layers of data analysis</b></i> as in the mainstream <font color=“#FF0000”><b>LotWon</b></font> software - <b>frequency groups</b> only;\r\n
<li> <i><b>the skips reports show correctly for analyses greater than 1000 past drawings - yes, lotto numbers can skip sometimes over 1000 draws in the same position!</b></i>\r\n
<li> June – September 2016 — Total winnings pick-4: $5,000 * 8 = $40,000. <i>ROI</i> (return on investment): 1724%. This must be the most efficient lottery strategy in history!\r\n
<li> <u>The best way to apply this <b>super lottery strategy</b>:</u> Instead of playing the strategy one at a time (layer by layer), play the strategies for all 6 layers <u>at the same time</u>.\r\n
</UL>\r\n- Go to the end of every \r\n code and press Delete; a single, long line is created:
<UL>\r\n<li> <i><b>layers of data analysis</b></i> as in the mainstream <font color=“#FF0000”><b>LotWon</b></font> software - <b>frequency groups</b> only;\r\n
<li> <i><b>the skips reports show correctly for analyses greater than 1000 past drawings - yes, lotto numbers can skip sometimes over 1000 draws in the same position!</b></i>\r\n<li> June – September 2016 — Total winnings pick-4: $5,000 * 8 = $40,000. <i>ROI</i> (return on investment): 1724%. This must be the most efficient lottery strategy in history!\r\n<li> <u>The best way to apply this <b>super lottery strategy</b>:</u> Instead of playing the strategy one at a time (layer by layer), play the strategies for all 6 layers <u>at the same time</u>.\r\n</UL>\r\n- Copy the new text to replace with, which is now one paragraph (a single long line); paste it into the ‘Replace with’ textbox.
It works for me in 64-bit Windows 10, version 1703. You might want to test first by copying a couple of files to C:\TEMP and apply the procedure to those files.
Cheers!
Parpaluck
“The foolish man, the silly woman, the infatuated child draw beverage from the swamp, when crystalline water is aplenty in the rock nearby.” -
-
Mr. Saliu,
if I’m allowed to answer, normally the eol which is currently in use is grayed out.
So in your case I would expect that the file has already only LF chars at the end of each line.In addition, I run my virtualbox and started windows 10 64bit, installed npp 7.3.3 (32).
Here you can see how I successfully replaced multiline text
of one of your websites. If this doesn’t work for you I would give it a try to run npp without additional
plugins (if installed at all) - maybe one of those makes troubles as well.Cheers
Claudia -
@Claudia Frank
Why do you call me names? What does it mean, “Mr. Saliu”? Who you talkin to?
I clicked on your “Here” link, and I get this:
“https://webmshare.com/m888e
NppOnWindows10ReplaceDemo
Error; Unsupported video type or invalid file path”What is that “virtualbox”? My Windows 10 v1703 has nothing like that on my 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.
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++.
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).
Cheers!
Parpaluck
“The foolish man, the silly woman, the infatuated child draw beverage from the swamp, when crystalline water is aplenty in the rock nearby.” -
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++.
-
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 -
“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!
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!
-
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. -
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
andLF
) 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
-