• 0 Votes
    11 Posts
    994 Views
    guy038G

    Hello, @dr-ramaanand, @alan-kilborn, @peterjones and All,

    @dr-ramaanand, here is my only contribution to your problem :

    If you’ll find this solution insteresting, just be nice and make a donation to @Don-ho. It’s, I think, the least you can do !

    If I assume that :

    There is only 1 concerned zone, of consecutive <H2>.......</H2> blocks, located right after the <H1>.......</H1> block

    The text of these <H2>.......</H2> blocks must be copied before the last line of your file which contains the string Please E-Mail us

    And that your INPUT text is :

    <H1........>Heading1</H1> <H2........>Some text</H2> <H2........>Different text</H2> <H2........>Altogether different text</H2> Some paragraphs here </P> (or </ul>) <P..........><span..........><b>Please E-mail us</b></span></P> <H2........>Heading that should not be reproduced</H2> Some paragraphs here </ul> (or </P>) <P..........><b><span..........>Please E-mail us</span></b></P>

    Note : Each <H2>..........</H2> line may be preceded and/or followed with tabulation and/or space characters

    Then :

    Open a new tab

    Paste the above INPUT text in this new tab

    Open the Replace dialog ( Ctrl + H )

    Select the Regular expression mode and tick the Wrap around option

    Follow the road map, below

    Note : I’ll use the free-spacing mode, (?x), in order to easily identify the main parts of the search regexes

    With the first regex S/R, below, we’ll place the line @@@ right before the last line of the file containing the string Please E-mail us

    SEARCH (?xsi) \A .+ \K (?= ^ <P .+ Please \x20 E-mail \x20 us )

    REPLACE @@@\r\n

    So, we get this temporary OUTPUT :

    <H1........>Heading1</H1> <H2........>Some text</H2> <H2........>Different text</H2> <H2........>Altogether different text</H2> Some paragraphs here </P> (or </ul>) <P..........><span..........><b>Please E-mail us</b></span></P> <H2........>Heading that should not be reproduced</H2> Some paragraphs here </ul> (or </P>) @@@ <P..........><b><span..........>Please E-mail us</span></b></P>

    With the second regex S/R, below, we’ll recopy all the <H2>.......</H2> lines, located right after the <H1>.....</H1> block, just before the delimiter line @@@

    SEARCH (?xsi) (?<= </H1> \r\n ) ( \s* (?: <H2.+?> .+? </H2> \s* )+ ) ^ .+ \K (?= @@@ \R)

    REPLACE \1

    And the obtain this temporary OUTPUT :

    <H1........>Heading1</H1> <H2........>Some text</H2> <H2........>Different text</H2> <H2........>Altogether different text</H2> Some paragraphs here </P> (or </ul>) <P..........><span..........><b>Please E-mail us</b></span></P> <H2........>Heading that should not be reproduced</H2> Some paragraphs here </ul> (or </P>) <H2........>Some text</H2> <H2........>Different text</H2> <H2........>Altogether different text</H2> @@@ <P..........><b><span..........>Please E-mail us</span></b></P>

    Note that the line <H2........>Heading that should not be reproduced</H2>, which is not consecutive to the other H2 lines, is not re-copied, as expected !

    Now, with the third regex S/R, below, we’ll just rewrite the text of all these <H2>.....</H2> blocks, in a single line :

    SEARCH (?xi-s) .+ > (.+) </H2> \h* \R (?= ( (?: \h* <H2 .+ \R )+ )? @@@ \R )

    REPLACE We have a \1?2, :.

    We get the temporary OUTPUT :

    <H1........>Heading1</H1> <H2........>Some text</H2> <H2........>Different text</H2> <H2........>Altogether different text</H2> Some paragraphs here </P> (or </ul>) <P..........><span..........><b>Please E-mail us</b></span></P> <H2........>Heading that should not be reproduced</H2> Some paragraphs here </ul> (or </P>) We have a Some text, We have a Different text, We have a Altogether different text.@@@ <P..........><b><span..........>Please E-mail us</span></b></P>

    Finally, with the fourth regex S/R , below, we simply add the leading <P........> part and delete the @@@ string, alltogether

    SEARCH (?x-s) ^ ( .+) @@@ $

    REPLACE <P whatever you need >\1

    And here is your expected OUTPUT text :

    <H1........>Heading1</H1> <H2........>Some text</H2> <H2........>Different text</H2> <H2........>Altogether different text</H2> Some paragraphs here </P> (or </ul>) <P..........><span..........><b>Please E-mail us</b></span></P> <H2........>Heading that should not be reproduced</H2> Some paragraphs here </ul> (or </P>) <P whatever you need >We have a Some text, We have a Different text, We have a Altogether different text. <P..........><b><span..........>Please E-mail us</span></b></P>

    Best Regards,

    guy038

  • Trim Leading Space Doesnt Work

    7
    0 Votes
    7 Posts
    892 Views
    PeterJonesP

    @Alejandro-Alvarez said in Trim Leading Space Doesnt Work:

    @Alan-Kilborn
    The regex method worked but the trim leading space option doesn’t, with or without selection… any plugin needs to be installed for it to work?

    No, no plugin. It works just fine natively in Notepad++.

    Some scatter-debug suggestions:

    Can you share your ?-menu Debug Info? Also, can you share a screenshot when the View > Show Symbol > Show all characters… (maybe it’s not actual spaces at the beginning, though then the regex wouldn’t work). What are your Settings > Preferences > Editing > Line Wrap set at? Maybe you just have wrapped lines, so what you see as the beginning of the line is really the middle of a wrapped line. Another idea: try downloading a portable copy of Notepad++ and seeing if that works better for you than your installed Notepad++. If so, maybe a plugin has messed up Notepad++, or your installation is corrupted somehow.
  • Elastic Tabstops plugin disappeared

    4
    0 Votes
    4 Posts
    2k Views
    Alan KilbornA

    @mariusv-github said in Elastic Tabstops plugin disappeared:

    I release a new version 1.5 for Elastic Tabstops completely rewritten (from Dailey version)

    Please see my comments HERE.

  • Can I Change the Program Tray Icon

    6
    0 Votes
    6 Posts
    793 Views
    NotSoBitWiseN

    That’s correct and was my misunderstanding.

    I understood his reference to icon editing apps but thought that required recompilation to replace the icon.

    While I have used Greenfish frequently for creating shortcut icons, I was unaware it could directly edit and save an icon embedded in the EXE.

    I had decided to replace the NPP shortcut icon and knew Greenfish could pull icons from an EXE or DLL so I wanted to see if there was an alternative icon I might use for the shortcut. It was a complete surprise to see the Replace option.

    As you might suspect, I’m not a developer so very much appreciate the guidance offered in the forum!

  • Instance trouble!!!

    2
    0 Votes
    2 Posts
    215 Views
    Alan KilbornA

    @WolfyRed said in Instance trouble!!!:

    Notepad++ Instances don’t make any sense

    Yes they do.

    but I have to have all files on all of my other Instances saved before I move them to another Instance

    Yes, because another instance of the program is totally separate from the first instance. Think of it as a different program, like Word for example. You wouldn’t be able to communicate to Word to accept a file from Notepad++ without the file being saved first; same thing when talking about two instances of Notepad++.

    I suppose Notepad++ could be changed to do “more” when it comes to several instances, but I don’t see very much value in it.

    multiple instances don’t open back up when closing and reopening Notepad++, it just opens the original first Instance.

    A few people seem to think this is what should happen.
    As instances are totally independent, it is working as designed.

  • from prompt command

    3
    0 Votes
    3 Posts
    209 Views
    Marco Dell'OcaM

    @Alan-Kilborn
    perfect, many thanks
    Marco Dell’Oca

  • search results without a new window

    7
    0 Votes
    7 Posts
    2k Views
    EkopalypseE

    @Bernd-Rudolf-Oldengott said in search results without a new window:

    sorry for the lack of translation

    Kein Problem, übrigens, deepl.com macht hier einen hervorragenden Job. Absolut empfehlenswert. Benutze ich, seit ich es kenne, immer.

    No problem, by the way, deepl.com does an excellent job here. Absolutely recommendable. I’ve been using it ever since I’ve known it.

  • want home-key to move cursor to very-start of line

    7
    3 Votes
    7 Posts
    2k Views
    Bob SteinB

    The Settings | Shortcut mapper | Scintilla commands | SCI_HOMEDISPLAY setting worked for me. A bit tedious to resolve the conflict. Soviet era UX.

    Screenshot 2022-12-02 18.58.54.png

  • Setup Notepad++ with cloud syncing?

    15
    0 Votes
    15 Posts
    53k Views
    Thomas ArthurT

    @Pim-x same! - I think it would be huge to allow either adding this feature - it’s not like they couldn’t even let the burden of storage fall on a user’s OneDrive or GoogleDrive or DropBox or something - but at least let us point to a data store for our open tabs/files/etc.

  • Add files from document list to Project

    4
    1 Votes
    4 Posts
    390 Views
    Rodrigo SantosR

    Thanks for the detailed response. You are right, it may just be easier to reopen them in the project itself.

  • Finding matches

    5
    0 Votes
    5 Posts
    2k Views
    Alan KilbornA

    @Alan-Kilborn said in Finding matches:

    but as a new candidate example for the math-replacement-FAQ

    We’ve gussied up the code above and did indeed add it to the FAQ.

  • Deleting Sections

    4
    0 Votes
    4 Posts
    386 Views
    BerkanB

    @guy038 Thank you for your help. It worked perfectly

  • Transfer temp 'new' files from old system to new system

    4
    0 Votes
    4 Posts
    4k Views
    PeterJonesP

    @GFS-Invest said in Transfer temp ‘new’ files from old system to new system:

    When I start up NotePad++ on my new system, the temp ‘new’ are not being opened.

    To give some color as to why: Notepad++ doesn’t just look at the backup folder and load all of those files; instead, it has a session file, which tells it how many unsaved files are currently open, and which temporary backup file each of those unsaved files maps to.

    While Notepad++ doesn’t do that, you can use a scripting language of some sort to do it. For example, here I published a solution that works with the PythonScript plugin: it will scan through your backup directory, and add a file to the current session for each file in that directory.

    But as Alan says, with only a handful of files (and 8 is easily within those bounds), don’t bother with that script: just manually copy the data from those into new file(s).

    And I second his encouragement to use known-location saved files. I always have a file open at work that is Peter's Scratchpad: it’s where I put in my “temporary” stuff, which I may delete from at a moment’s notice, but is always saved, so the “temporary” data can persist for seconds, minutes, hours, days, months, or years. (Yes, I do have stuff in there for years – it’s where I keep my list of unicode checkboxes and arrows that I frequently use and want to be able to easily copy/paste into other documents or into forums like this → ☑.)

  • PythonScript get filenames in both views

    4
    1 Votes
    4 Posts
    521 Views
    Alan KilbornA

    @Alan-Kilborn said:

    Regarding:

    If a view is not open and you ask for the getCurrentDocIndex() on that view, it will return an “interesting” thing

    See:

    https://github.com/bruderstein/PythonScript/issues/255

  • New document | Default langauge not working for new NP++ instance

    4
    0 Votes
    4 Posts
    803 Views
    Craig O'NeilC

    @PeterJones thanks for all your help with this.
    cheers, Craig.

  • CLIPBOARD-RELATED crashes

    3
    0 Votes
    3 Posts
    396 Views
    PeterJonesP

    @TIBETALIA ,

    See a related discussion here, which mentions a non-Notepad++ tool for tracking the clipboard history. Normally, I wouldn’t recommend an external tool, but for you, it would help, because even if Notepad++ crashes, that external tool should not, so you should not lose your clipboard contents.

  • Notepad ++ not responding when saving XML file

    18
    0 Votes
    18 Posts
    6k Views
    Graham CollinsG

    This happened to me on 8.4.7. Disabling the options mentioned by @joel-rodriguez worked for me

  • Find the specific word in notpad++

    4
    0 Votes
    4 Posts
    426 Views
    Alan KilbornA

    @Dark-Light

    I misread the problem statement; @Silent_Macjedi 's answer is more accurate for the stated need than mine, please use that.

  • Comparing files

    7
    0 Votes
    7 Posts
    478 Views
    Mario CastroM

    Thanks :)

  • find function

    5
    0 Votes
    5 Posts
    440 Views
    Richard BruceR

    @Alan-Kilborn perfect thank you