Community
    • Login

    How do I replace some text?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    html
    13 Posts 2 Posters 475 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.
    • Scott NielsonS
      Scott Nielson @Scott Nielson
      last edited by Scott Nielson

      For your information, the text does not start with the word, “Note”, there is some html code before it.

      1 Reply Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn
        last edited by

        Most of your 17 posts start with “How do I replace…”.
        This is not a data manipulation service.
        At this point we ask you to supply what you have tried on your data, in order to receive further help.

        Scott NielsonS 5 Replies Last reply Reply Quote 0
        • Scott NielsonS
          Scott Nielson @Alan Kilborn
          last edited by

          @Alan-Kilborn I thought I had explained it.
          In the RegEx mode, I checked the “Match case”, put (?s)^\s*Note:.+([^<)*)(?=</span></p>) in the “find” field and Note: Wherever it is found, "<" denotes aggravation \(worse by\), ">" denotes amelioration \(better by\), "<->" denotes alternates with and A/F is an abbreviation of, "Ailments from"</span></p> in the “Replace” field but it didn’t do nothing.

          When I put (?s)\s*Note:.+([^<)*)(?=</span></p>) in the “find” field, half the files are found but not all.

          1 Reply Last reply Reply Quote 0
          • Scott NielsonS
            Scott Nielson @Alan Kilborn
            last edited by Scott Nielson

            @Alan-Kilborn When I put (?s)\s*Note:.+([^<)*)(?=</span></p>) in the “find” field, half the files (out of multiple files) with that text are found but not all, besides it replaces everything till the last </span></p> in each file is found but I want it to stop searching beyond the first occurrence of </span></p>

            1 Reply Last reply Reply Quote 0
            • Scott NielsonS
              Scott Nielson @Alan Kilborn
              last edited by Scott Nielson

              @Alan-Kilborn If I use (?=Note)([^<)*) in the “find” field, only half that text is found, that is till it reaches the first <

              1 Reply Last reply Reply Quote 0
              • Scott NielsonS
                Scott Nielson @Alan Kilborn
                last edited by

                @Alan-Kilborn If I use (?:<)(*SKIP)(*FAIL)|(Note.+</span>) in the “find” field, everything except the </p> is matched (which anyway is not needed if I skip that in the “replace” field also) but it only replaces that text in 70 out of 150 files. Something is wrong and I need help!

                1 Reply Last reply Reply Quote 0
                • Scott NielsonS
                  Scott Nielson @Alan Kilborn
                  last edited by

                  @Alan-Kilborn OK, I got it - the other 80 files had a <br> tag at the end and when I used that instead of the </span> tag at the end, I was able to find and replace the text in the other 80 files also. Thanks a million anyway.

                  1 Reply Last reply Reply Quote 2
                  • Alan KilbornA
                    Alan Kilborn
                    last edited by

                    Sorry, I didn’t notice that you had supplied what you tried.
                    And in the interim it appears that you solved the problem yourself.
                    This is good.

                    Scott NielsonS 2 Replies Last reply Reply Quote 3
                    • Scott NielsonS
                      Scott Nielson @Alan Kilborn
                      last edited by Scott Nielson

                      @Alan-Kilborn or anyone else, The text that I aked to help with (what I’ve posted right on top) has been replaced with some HTML code in between and is now like:-

                      Note:
                      Wherever it is found, &quot;&lt;&quot; denotes aggravation (worse by),
                      &quot;&gt;&quot; denotes amelioration (better by), </span><span lang=EN-US
                      style='font-size:13.5pt;line-height:115%;font-family:"Verdana","sans-serif";
                      color:black;mso-themecolor:text1'>&quot;</span><span style='font-size:13.5pt;
                      line-height:115%;font-family:"Verdana","sans-serif";mso-fareast-font-family:
                      "Times New Roman";mso-bidi-font-family:"Times New Roman";color:black;
                      mso-ansi-language:EN-US'>&lt;-&gt;</span><span lang=EN-US style='font-size:
                      13.5pt;line-height:115%;font-family:"Verdana","sans-serif";color:black;
                      mso-themecolor:text1'>&quot;</span><span style='font-size:13.5pt;line-height:
                      115%;font-family:"Verdana","sans-serif";mso-fareast-font-family:"Times New Roman";
                      mso-bidi-font-family:"Times New Roman";color:black;mso-ansi-language:EN-US'>
                      denotes alternates with and A/F is an abbreviation of, &quot;Ailments from&quot;</span><span
                      lang=EN-US style='font-size:13.5pt;line-height:115%;font-family:"Verdana","sans-serif";
                      color:black;mso-themecolor:text1'><o:p></o:p></span></p>
                      

                      I wanted to replace that with something else again but the above RegEx, (?:<)(*SKIP)(*FAIL)|(Note.+</span>) doesn’t find it anymore. Please tell me how to find this new text now. Thanks in advance for the help!

                      1 Reply Last reply Reply Quote 0
                      • Scott NielsonS
                        Scott Nielson @Alan Kilborn
                        last edited by

                        @Alan-Kilborn This RegEx, (?s)(?<=Note).*?(?=</p>) finds what I want it to but is it correct as a RegEx?

                        Alan KilbornA 1 Reply Last reply Reply Quote 0
                        • Alan KilbornA
                          Alan Kilborn @Scott Nielson
                          last edited by

                          @Scott-Nielson said in How do I replace some text?:

                          but is it correct as a RegEx?

                          Sure looks correct.

                          Scott NielsonS 1 Reply Last reply Reply Quote 1
                          • Scott NielsonS
                            Scott Nielson @Alan Kilborn
                            last edited by

                            @Alan-Kilborn OK, thanks a lot! Hasta la vista.

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