• Login
Community
  • Login

Can I search and replace in more than one page at once

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
replacesearch
9 Posts 4 Posters 4.1k 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.
  • K
    kichererbse
    last edited by Oct 17, 2016, 2:52 PM

    Problem one:
    I just uploaded 60 pages of my new site. Just to realize, that I have the same mistake in the navigation on every single page. Is there a posibility to change this mistake on all pages? I can’t even do search and replace in one file, because the search and replace concerns two lines, and that does not work.
    Maybe I should have used wordpress (yuck) after all, changes in navigation are easy to change there (but that is the only thing I can say positive about wordpress).
    It is not the problem to upload that all again, but to open every single file, change, and close again.
    (Way back in the 1990ies, when I did use Frontpage to make my sites, it was possibel to do just that… memories…)

    Problem two:
    Spelling is not working for german words. notepad underlines almost every german word. Is there a simple way to change spelling (only content) to German?

    A quick help would be much appreciated. (I tried so search the forum, funny, nobody seems to have my problems…)

    1 Reply Last reply Reply Quote 0
    • H
      Hamit Devecioğlu
      last edited by Oct 17, 2016, 3:54 PM

      @kichererbse said:

      I just uploaded 60 pages of my new site. Just to realize, that I have the same mistake in the navigation on every single page. Is there a posibility to change this mistake on all pages? I can’t even do search and replace in one file, because the search and replace concerns two lines, and that does not work.

      You don’t mean that?
      http://i.hizliresim.com/PQZov5.jpg

      1 Reply Last reply Reply Quote 0
      • K
        kichererbse
        last edited by Oct 17, 2016, 5:36 PM

        I thought some time ago that this would be the solution.
        As it is, I have to add a complete new line like this:

        <li><a href=“link is already online1.htm”>existing link1</a></li>
        <li><a href=“link that I forgot and should ad.htm”>link that should be added in between</a></li>
        <li><a href=“link is already online2.htm”>existing link2</a></li>

        so, I wanted to search :
        <li><a href=“link is already online1.htm”>existing link1</a></li>
        and replace with:
        <li><a href=“link is already online1.htm”>existing link1</a></li>
        <li><a href=“link that I forgot and should ad.htm”>link that should be added</a></li>

        and this does not work, it seems, as if I could only add as much as fits in one line…

        I could probably just write the whole code in one line, then it would maybe work - I have not tried it, yet, but thats not a very clean solution, is it?

        What is the secret of “wrap around”?

        1 Reply Last reply Reply Quote 0
        • K
          kichererbse
          last edited by Oct 17, 2016, 6:04 PM

          I could not edit my last answer. I know what wrap around is, sorry.

          How could this replacement-line work?

          1 Reply Last reply Reply Quote 0
          • C
            cmeriaux
            last edited by Oct 17, 2016, 9:40 PM

            The multiple search and replace is supposed to work with \n option or regular expression

            1 Reply Last reply Reply Quote 0
            • G
              guy038
              last edited by guy038 Oct 18, 2016, 6:01 PM Oct 17, 2016, 10:44 PM

              Hello kichererbse,

              Ah, remember : With Notepad++, much more solutions than problems !!!

              I suppose that your 60 HTML pages are gathered in a same folder ?

              • First of all, just BACKUP this folder ( One never knows !! )

              • Start Notepad++

              • Open just one file, among your 60 HTML files

              • Open the Find in Files dialog ( CTRL + SHIFT + F )

              • In the Find what: zone, type the string <li><a href="link is already online1\.htm">existing link1</a></li>

              • In the Replace with zone, type the string <li><a href="link is already online1.htm">existing link1</a></li>\r\n<li><a href="link that I forgot and should ad.htm">link that should be added</a></li>

              • In the Filters : zone, type *.htm or may be, *.html

              • As soon as you check the Follow current doc option, the absolute path of your HTML files should be written in the Directory : zone

              • Uncheck the options In all sub-folders and In hidden folders

              • At the bottom, in the Search Mode area, select the Regular expression option ( IMPORTANT )

              • Click on the Replace in Files button

              => The message, below, appears :

              Are you sure you want to replace all occurrences in :
              C:\....\.....\....\Name of your folder
              for file type : *.html
              

              Click on the OK button

              => At once, all your files will be modified, and saved, again, automatically :-))

              Et voilà !

              Notes :

              • The regex search expression is quite identical to your text, except for the dot, which must be escaped \., to be taken literally, as it’s a special regex symbol !

              • Similarly, the regex replacement expression is quite identical, except that I added the form \r\n, between the text of the two lines. Indeed, these two characters represent the two EOL Windows characters ( CR + LF), in order to rewrite the replacement zone, in two consecutive lines

              • If you’re using Unix files, just add the form \n, instead of \r\n !

              • In the replacement zone, the dot symbol is considered as a normal dot character

              IMPORTANT :

              If you select the search and replacement regexes, from your browser, and paste them, in a Notepad++ new tab, may be you’ll have to replace the two Unicode characters “ and ” by the standard " double quote character, before putting them in the Find in Files dialog !!

              Best Regards,

              guy038

              P.S. :

              You’ll find good documentation, about the new Boost C++ Regex library, v1.55.0 ( similar to the PERL Regular Common Expressions, v1.48.0 ), used by Notepad++, since its 6.0 version, at the TWO addresses below :

              http://www.boost.org/doc/libs/1_48_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html

              http://www.boost.org/doc/libs/1_48_0/libs/regex/doc/html/boost_regex/format/boost_format_syntax.html

              • The FIRST link explains the syntax, of regular expressions, in the SEARCH part

              • The SECOND link explains the syntax, of regular expressions, in the REPLACEMENT part

              We may, also, look for valuable informations, on the sites, below :

              http://www.regular-expressions.info

              http://www.rexegg.com

              http://perldoc.perl.org/perlre.html

              To end with, you may ask, the N++ Community, for infos on any tricky regex that you came across OR for building any tricky regex, for a particular purpose :-))

              1 Reply Last reply Reply Quote 1
              • K
                kichererbse
                last edited by Oct 18, 2016, 7:26 AM

                That did it. Unbelievable. I knew notepad++ is a mighty tool, but one has to know, how to use it. (Besides klicking on “Regular expression” I had to select "Finds \r \n. )
                Problem solved. Thank you ever so much!

                1 Reply Last reply Reply Quote 0
                • K
                  kichererbse
                  last edited by kichererbse Nov 12, 2016, 1:16 PM Nov 12, 2016, 1:14 PM

                  Hi, it’s me again. I tried
                  search
                  <link rel=“stylesheet” href=“http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css”>
                  and replace (with httpS)
                  <link rel=“stylesheet” href=“https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css”>
                  and it did not work?

                  Where would I place a - is it called backslash - if I need to?

                  Thanks!

                  1 Reply Last reply Reply Quote 0
                  • G
                    guy038
                    last edited by guy038 Nov 13, 2016, 4:52 PM Nov 13, 2016, 4:51 PM

                    Hi, kichererbse,

                    I think that you may perform that specific S/R, simply, in Normal search mode !

                    Depending on the change of http into https must be run on all the links of your file or, strictly, on the addresses relative to the cdnjs.cloudflare.com site :

                    • Select the searched string http or all the contents between quotes

                    • In replacement, repeat the searched expression, just adding the s letter, after the string http

                    Best Regards,

                    guy038

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