How do I replace some text?



  • I want this text:-

    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""<" denotes aggravation worse by, ">" denotes amelioration better by, "<->" denotes alternates with and A/F is an abbreviation of, "Ailments from"</span></p>
    
    

    to become like:-

    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 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.
    Please help. I’m going bananas!



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



  • 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.



  • @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.



  • @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>



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



  • @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!



  • @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.



  • 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.



  • @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!



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



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

    but is it correct as a RegEx?

    Sure looks correct.



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


Log in to reply