How to replace whole paragraph with extended replacement.



  • For example in html. I think its not possible using npp regex.
    Please don’t suggest smart solutions, I want some kind of prepared plugin/suggestion of other program to help or something trivial, if its more complicated please make video for youtube or other streaming platform. When I type the text into search query it work. Replacing text using extended search attributes (/r/n) don’t work for me on version 5.1. The text contains some obligatory spaces I think I can manually correct.

    I came from there



  • @Anon-A said:

    Replacing text using extended search attributes (/r/n) don’t work for me on version 5.1

    First off, you haven’t exactly given us a lot to go on. The title suggests you need to replace paragraphs, and you also refer to html code. So is it a paragraph in the original html code, or a paragraph as html code is shown in a browser? Is it a line as shown in Notepad++?

    Also the version 5.1, is this Notepad++ version, if so it’s seriously old, have you thought about upgrading the version. I currently use 7.6.3 which I’ll stay at until all the newer stuff settles down.

    Terry



  • The reason I use 5.1 is support for snippets+ and snippets plugin.
    Ok, there is sample
    Text to replace in some documents
    <ul>
    <a href=“www.site.com”><li>This is a paragraph.</li>
    <a href=“C:\x\y\z”><li>This is a paragraph.</li>
    <a href=“www.site.com”><li>This is a paragraph.</li>
    </ul>
    Replace with:
    <ul>This is a Heading
    <a href=“www.site.com”><li>This is a paragraph.</li>
    <a href=“C:/x/y/z”><li>This is a paragraph.</li>
    <a href=“www.site.com”><li>This is a paragraph.</li>
    </ul>

    or something like this:
    Text to replace in some documents
    <ul id=“id1”>This is a Heading
    <a href=“www.site.com”><li>This is a paragraph.</li>
    <a href=“C:/x/y/z”><li>This is a paragraph.</li>
    <a href=“www.site.com”><li>This is a paragraph.</li>
    </ul id=“id1”>
    Replace with:
    <ul id=“id1”>This is a Heading
    <a href=“www”><li>This is a paragraph.</li>
    <a href=“C:\x\y\z”><li>This is a paragraph.</li>
    <a href=“www”><li>This is a paragraph.</li>
    </ul id=“id1”>



  • @Anon-A said:

    The reason I use 5.1 is support for snippets+ and snippets plugin.



  • @Anon-A said:

    The reason I use 5.1 is support for snippets+ and snippets plugin

    As @andrecool-68 has shown, Snippets is available in a later version. If you aren’t sure about upgrading to a later version, may I suggest installing a ‘portable’ version of Notepad++. It can work independently of an installed version. I’m not sure the Scintilla engine in the version you have will support all regular expression solutions someone might supply, there were at least 2 upgrades to that engine since your version, so very likely enhancements.

    At the moment I cannot see the link for the portable version, hopefully one of the other contributors might supply that info.

    As for your html code example, I’m still none the wiser what you want to replace. You show paragraphs between <li> and </li> codes. These could be used to pick only that text, even if over several lines by use of the regex modifier (?s) which means work over more than 1 line.

    Or do you mean to replace all code between the <ul> and </ul> codes?

    If you are replacing the html code in these blocks I’m wondering if you actually want a regex to do the replacement, or maybe you just want to use the "Mark’ function so you can more readily find the location and then change it manually. I can’t think of a reason to change multiple areas of code with the same replacement (which is where regex works best).

    Terry



  • @Anon-A
    I found a link for the portable version, it’s at:
    https://portableapps.com/apps/development/notepadpp_portable

    There may be other links as well This is the 7.6.3 version, so very similar environment to what I use. It’s just shy of the latest version and is very stable. After this there has been a lot of changes and things are still settling down.

    Terry



  • @Anon-A @Terry-R and all

    please do not use the portableapps.com version, as it is currently broken regarding plugins.

    see here: https://notepad-plus-plus.org/community/topic/17200/7-6-3-plugins-admin-option-not-visible-in-menu
    and here: https://notepad-plus-plus.org/community/topic/17188/npppluginlist-dll-disappears-from-plugins-config-every-time-plugins-admin-disappears-also

    please only download the official portable version from >>> here <<<.

    full download page: https://notepad-plus-plus.org/download/
    (the zip packages are the portable versions)

    note: it is always recommended to use the official portable version only, as it is created by the developers, implementing all their own recent code changes.
    all other 3rd party releases might miss some code changes when packaging, leading to unexpected behaviour.



  • @Terry-R

    I found a link for the portable version

    Consider this a virtual downvote to that. :)



  • @Alan-Kilborn said:

    Consider this a virtual downvote

    So noted, sorry my bad.

    I don’t use the portable version so was unsure of the correct location. The download page doesn’t readily identify the portable versions, so unless you know it’s the zip package it’s hard to spot.

    Thanks for the heads-up.

    Terry



  • @Terry-R said:

    The download page doesn’t readily identify the portable versions

    You’re right. I added issue #5415: website downloads page: mark “portable” downloads



  • @Terry-R

    The download page doesn’t readily identify the portable versions

    Very true. All it says is “Don’t want to use installer?” next to the portable version downloads. It just adds to user confusion. Hey @donho, how about changing it on the website:

    Go from:
    Don’t want to use installer? Check this one (zip format).

    To this:
    Don’t want to use installer? Grab the Portable Version (zip format).

    …and similar for the 7z format



  • @PeterJones

    ps: i have also submitted quite a few issue and code reports lately, breaking my rule to submit one after the other, waiting until the first gets looked at or fixed.
    so it seems as if i might already be a pain in the a… without “faq” 😂

    @Alan-Kilborn

    very cool new avatar logo. 👍
    is it a preparation for a flood of upcoming a.k. animated gifs, with intro/outro splash screens (or family pictures), due to eventually having started to play around a bit, and beginning to like them ? 😉


Log in to reply