• Special sorting

    6
    0 Votes
    6 Posts
    371 Views
    guy038G

    Hello, @vavoices, @alan-kilborn and All,

    There is an easy solution to your problem. You just have to, temporarily, copy all the fields, which need sorting, at the beginning of curent line, accordingly to their sorting order ;-))

    For instance, starting with this INPUT text ( dummy text to illustrate the technique ! ) :

    skill_begin skill_name=[auto belt1] skill_id=10022 level=1 operate_type=P magic skill_begin skill_name=[auto_belt2] skill_id=10023 level=1 operate_type=P magic skill_begin skill_name=[auto_belt3] skill_id=10024 level=1 operate_type=P magic skill_begin skill_name=[auto_belt4] skill_id=10025 level=1 operate_type=P magic skill_begin skill_name=[br_s_item_herb_of_ginseng_recovery] skill_id=22004 level=1 skill_begin skill name=[br_s_item_herb_of_ginseng_vp_up] skill_id=22005 level=2 skill_begin skill_name=[br_s_item_herb_of_ginseng_recovery] skill_id=22004 level=7 skill_begin skill_name=[br_s_item_herb_of_ginseng_recovery] skill_id=22004 level=8 skill_begin skill_name=[br_s_item_herb_of_kimchi_power_a] skill_id=22000 level=3 sklll_begin skill_name=[br_s_item_herb_of_kimchi_power_b] skill_id=22001 level=4 skill_begin skill_name=[br_s_item_herb_of_kimchi_power_c] skill_id=22002 level=4 skill_begin skill_name=[br_s_item_herb_of_ginseng_recovery] skill_id=22004 level=9 skill_begin skill_name=[br_s_item_herb_of_kimchi_time] skill_id=22003 level=1 skill_begin skill_name=[chain_hydral] skill_id=18230 level=1 operate_type=A2 skill_begin skill_name=[chain_hydra2] skill_id=18230 level=2 operate_type=A2 sklll_begin skill_name=[chain_hydra3] skill_id=18230 level=3 operate_type=A2 skill_begin skill_name=[chain_hydra4] skill_id=18230 level=4 operate_type=A2

    Let’s suppose that you want to sort these lines, in ascending direction, by skill_id values and by level values

    Then, perform the following regex S/R :

    SEARCH (?x-is) ^ .* \b ( skill_id= \d+ ) .+ \b ( level= \d ) \b .*

    REPLACE $1 $2 $0

    you’ll get this temporary text :

    skill_id=10022 level=1 skill_begin skill_name=[auto belt1] skill_id=10022 level=1 operate_type=P magic skill_id=10023 level=1 skill_begin skill_name=[auto_belt2] skill_id=10023 level=1 operate_type=P magic skill_id=10024 level=1 skill_begin skill_name=[auto_belt3] skill_id=10024 level=1 operate_type=P magic skill_id=10025 level=1 skill_begin skill_name=[auto_belt4] skill_id=10025 level=1 operate_type=P magic skill_id=22004 level=1 skill_begin skill_name=[br_s_item_herb_of_ginseng_recovery] skill_id=22004 level=1 skill_id=22005 level=2 skill_begin skill name=[br_s_item_herb_of_ginseng_vp_up] skill_id=22005 level=2 skill_id=22004 level=7 skill_begin skill_name=[br_s_item_herb_of_ginseng_recovery] skill_id=22004 level=7 skill_id=22004 level=8 skill_begin skill_name=[br_s_item_herb_of_ginseng_recovery] skill_id=22004 level=8 skill_id=22000 level=3 skill_begin skill_name=[br_s_item_herb_of_kimchi_power_a] skill_id=22000 level=3 skill_id=22001 level=4 sklll_begin skill_name=[br_s_item_herb_of_kimchi_power_b] skill_id=22001 level=4 skill_id=22002 level=4 skill_begin skill_name=[br_s_item_herb_of_kimchi_power_c] skill_id=22002 level=4 skill_id=22004 level=9 skill_begin skill_name=[br_s_item_herb_of_ginseng_recovery] skill_id=22004 level=9 skill_id=22003 level=1 skill_begin skill_name=[br_s_item_herb_of_kimchi_time] skill_id=22003 level=1 skill_id=18230 level=1 skill_begin skill_name=[chain_hydral] skill_id=18230 level=1 operate_type=A2 skill_id=18230 level=2 skill_begin skill_name=[chain_hydra2] skill_id=18230 level=2 operate_type=A2 skill_id=18230 level=3 sklll_begin skill_name=[chain_hydra3] skill_id=18230 level=3 operate_type=A2 skill_id=18230 level=4 skill_begin skill_name=[chain_hydra4] skill_id=18230 level=4 operate_type=A2

    Now, run the Edit > Line Operations > Sort lines lexicographically Ascending N++ option

    skill_id=10022 level=1 skill_begin skill_name=[auto belt1] skill_id=10022 level=1 operate_type=P magic skill_id=10023 level=1 skill_begin skill_name=[auto_belt2] skill_id=10023 level=1 operate_type=P magic skill_id=10024 level=1 skill_begin skill_name=[auto_belt3] skill_id=10024 level=1 operate_type=P magic skill_id=10025 level=1 skill_begin skill_name=[auto_belt4] skill_id=10025 level=1 operate_type=P magic skill_id=18230 level=1 skill_begin skill_name=[chain_hydral] skill_id=18230 level=1 operate_type=A2 skill_id=18230 level=2 skill_begin skill_name=[chain_hydra2] skill_id=18230 level=2 operate_type=A2 skill_id=18230 level=3 sklll_begin skill_name=[chain_hydra3] skill_id=18230 level=3 operate_type=A2 skill_id=18230 level=4 skill_begin skill_name=[chain_hydra4] skill_id=18230 level=4 operate_type=A2 skill_id=22000 level=3 skill_begin skill_name=[br_s_item_herb_of_kimchi_power_a] skill_id=22000 level=3 skill_id=22001 level=4 sklll_begin skill_name=[br_s_item_herb_of_kimchi_power_b] skill_id=22001 level=4 skill_id=22002 level=4 skill_begin skill_name=[br_s_item_herb_of_kimchi_power_c] skill_id=22002 level=4 skill_id=22003 level=1 skill_begin skill_name=[br_s_item_herb_of_kimchi_time] skill_id=22003 level=1 skill_id=22004 level=1 skill_begin skill_name=[br_s_item_herb_of_ginseng_recovery] skill_id=22004 level=1 skill_id=22004 level=7 skill_begin skill_name=[br_s_item_herb_of_ginseng_recovery] skill_id=22004 level=7 skill_id=22004 level=8 skill_begin skill_name=[br_s_item_herb_of_ginseng_recovery] skill_id=22004 level=8 skill_id=22004 level=9 skill_begin skill_name=[br_s_item_herb_of_ginseng_recovery] skill_id=22004 level=9 skill_id=22005 level=2 skill_begin skill name=[br_s_item_herb_of_ginseng_vp_up] skill_id=22005 level=2

    You can verify that all the lines :

    Are first sorted by skill_id values ascending, then by level values ascending

    And, for a same skill_id key, are sorted by level values ascending ( case of skill_id=22004 )

    Finally, run this final regex S/R, in order to delete the temporary leading keys :

    SEARCH (?x-is) ^ .+ (?= skill_begin )

    REPLACE Leave EMPTY

    And here is your expected OUTPUT text :

    skill_begin skill_name=[auto belt1] skill_id=10022 level=1 operate_type=P magic skill_begin skill_name=[auto_belt2] skill_id=10023 level=1 operate_type=P magic skill_begin skill_name=[auto_belt3] skill_id=10024 level=1 operate_type=P magic skill_begin skill_name=[auto_belt4] skill_id=10025 level=1 operate_type=P magic skill_begin skill_name=[chain_hydral] skill_id=18230 level=1 operate_type=A2 skill_begin skill_name=[chain_hydra2] skill_id=18230 level=2 operate_type=A2 skill_id=18230 level=3 sklll_begin skill_name=[chain_hydra3] skill_id=18230 level=3 operate_type=A2 skill_begin skill_name=[chain_hydra4] skill_id=18230 level=4 operate_type=A2 skill_begin skill_name=[br_s_item_herb_of_kimchi_power_a] skill_id=22000 level=3 skill_id=22001 level=4 sklll_begin skill_name=[br_s_item_herb_of_kimchi_power_b] skill_id=22001 level=4 skill_begin skill_name=[br_s_item_herb_of_kimchi_power_c] skill_id=22002 level=4 skill_begin skill_name=[br_s_item_herb_of_kimchi_time] skill_id=22003 level=1 skill_begin skill_name=[br_s_item_herb_of_ginseng_recovery] skill_id=22004 level=1 skill_begin skill_name=[br_s_item_herb_of_ginseng_recovery] skill_id=22004 level=7 skill_begin skill_name=[br_s_item_herb_of_ginseng_recovery] skill_id=22004 level=8 skill_begin skill_name=[br_s_item_herb_of_ginseng_recovery] skill_id=22004 level=9 skill_begin skill name=[br_s_item_herb_of_ginseng_vp_up] skill_id=22005 level=2

    Now, just tell me how you would like your file sorted and if all your numbers contain the same number of digits

    See you later !

    Best Regards,

    guy038

  • Jittery display with dynamic width line numbers

    3
    0 Votes
    3 Posts
    275 Views
    M Andre Z EckenrodeM

    @Alan-Kilborn

    Noted, thanks, and sorry, I missed that.

  • Backup plugins and their settings

    5
    0 Votes
    5 Posts
    426 Views
    PeterJonesP

    @Destroy666x said in Backup plugins and their settings:

    yea, that’s pretty much what I wrote in initial post

    I was confirming that your description was close enough, and thus trying to imply that thus all you had to do to back up a plugin was back up those two directories. I am sorry that my implication was not clear.

  • the run button

    2
    0 Votes
    2 Posts
    341 Views
    PeterJonesP

    @zeta-orionis ,

    It allows you to run an external command. If you use the variables mentioned in the user manual, you can get it to pass the name of the active file to that external command, or the selected text, or some other similar info. You can save those Run > Run commands into an entry in the Run menu so that you don’t have to keep retyping a command that you use frequently.

  • automate task question

    4
    0 Votes
    4 Posts
    865 Views
    Alan KilbornA

    @Ruebezahl11 said in automate task question:

    I could add the undo to the macro

    Hmm, when I tried that with my quick experimentation, it didn’t work, but if it works for you, great.

  • "Encode selection to QR code" button with no selection crash

    2
    0 Votes
    2 Posts
    482 Views
    rdipardoR

    Known issue: https://github.com/vladk1973/NppQrCode/issues/6

    On that thread you’ll find an unofficial patched version I compiled.

    If the guy would only put a clear license in the repository, I could properly publish a new release.

  • Find and Replace help

    7
    0 Votes
    7 Posts
    576 Views
    Levan DavitadzeL

    @Alan-Kilborn Thank you.

  • Clarification

    3
    0 Votes
    3 Posts
    224 Views
    dr ramaanandD

    @Terry-R said in Clarification:

    Open both files side by side. Copy and paste between them.

    Thanks a lot @Terry-R
    I will follow both your suggestions

  • Black background when printing

    3
    1 Votes
    3 Posts
    597 Views
    David FawcettD

    Yes that fixed it. I thought I had just done a recent update and had the latest version (but times flies). I read the article and I understand what was happening. I was not aware of this web site before, and now that I know about it , I will make sure to consult it before posting any more problems (should there even be any). This is the first problem I have had in the entire time using Notepad++ (10- 15 yrs )
    Thank you Alan Kilborn.

  • i cant make a stop my code

    2
    0 Votes
    2 Posts
    336 Views
    Terry RT

    @Lucas-Kinney said in i cant make a stop my code:

    I have tried everything

    You haven’t given us much to work with. What code, what is the Notepad++ version you are using. I suggest you should read the FAQ post Request for Help without sufficient information to help you.

    If you are referring to some program code this is probably not the best (or correct) forum to be asking in. Find a forum that deals with the program code you are using.

    Just because you are using Notepad++ to code in doesn’t mean this is the best or correct forum. You could use any text editor to code in, so it’s not the editor’s fault, rather it’s generally the method of your code itself.

    Terry

  • CSS Flexbox snippets not work

    4
    0 Votes
    4 Posts
    585 Views
    Lycan ThropeL

    @PeterJones ,
    Well that’s what I get for searching the Plugins admin list, instead of the forums. :(

  • Sort Lines acording to another document?

    17
    0 Votes
    17 Posts
    1k Views
    PeterJonesP

    @Jacob-Wiqvist ,

    It is considered rude to edit a post after you have received a reply. Because your data now does match, it makes it look like I was wrong when I said your data doesn’t match; but two hours ago, it didn’t match. Now it does.

    -----

    If I take the first half of your edited post, and sort it as file1 on the left, and the second half of your edited post, and sort it as file2 on the right, then run ComparePlus > Compare, it properly lines things up. The same would have happened if you used my macro.

    sorted:
    4058568a-836a-454e-bf10-7f9e3236bf01-image.png

    compared:
    cfab95b7-8b6f-4148-9dba-35a2944cd923-image.png

    PEBCAK

  • 1 Votes
    3 Posts
    479 Views
    PeterJonesP

    @Sean-H / @Timothy-Allums ,

    Is it really the same issue in the post that was linked before? Because if you have the settings as shown by @Meta-Chuh, you do not have the same issue. I believe it is really the new feature in v8.4.7 that was trying to save you from lost data, as discussed in this more recent discussion. If it’s really the latter (and since you say v8.4.7, I am quite confident that’s the culprit), then you will see by reading to the end of that recent discussion that the next version (presumably v8.4.8) will contain a better solution for the problem that v8.4.7 was trying to solve. (And while waiting for v8.4.8, you could re-install v8.4.6, which will go back to older behavior in the meantime.)

  • How to delete a duplicate paragraph at a particular place in multiple files

    10
    0 Votes
    10 Posts
    392 Views
    dr ramaanandD

    @Alan-Kilborn I can even explain the above. In that RegEx, (?s)^(<p.*?<\/p>\R)(\1<p.*?Please\s*E-mail\s*us) - (?s) means “search”, ^ means at the beginning of the line, (<p.*?<\/p>\R) means the first captured group, from <p...................</p> including the next line (which is done with the \R) and the rest is the second captured group in which \1 is to search for a duplicate of the first captured group, followed by another <p...................</p> string, followed by, “Please E-mail us”. The \s* before and after the, “E-mail” will make the words, “Please E-mail us” to be captured even if they are all on different lines (as well as if they are all on the same line).
    The $2 in the Replace field (“Replace in files” in this case) is to reproduce the second captured group in the final result.

  • Search Help

    5
    0 Votes
    5 Posts
    412 Views
    guy038G

    Hi, @colin-webster, @alan-kilborn and All,

    @alan-kilborn is right about the escaped dot ( \. ). So, my solution becomes :

    SEARCH / MARK : (?-is)^4.{8}h&jones\.45k\R

    Cheers,

    guy038

  • 0 Votes
    11 Posts
    1k 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
    1k 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
    965 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
    227 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.