• Macro about replacements from two Files in third File

    4
    0 Votes
    4 Posts
    217 Views
    EkopalypseE

    @Alan-Kilborn

    Yes, I personally would argue as I have, but who knows, maybe some developer will find this intriguing.

  • Location Navigate Plugin install hangs

    2
    0 Votes
    2 Posts
    166 Views
    EkopalypseE

    @haya-waks

    without more information about which Npp version you used and how you tried to install the plugin, it’s hard to tell what your problem might be.

  • Add Counter replacements ?

    2
  • WebEdit plugin tooltips out of sync?

    4
    0 Votes
    4 Posts
    352 Views
    PeterJonesP

    @Jon-Fleming ,

    Sorry, if the About dialog says 2010, I assume that was the last-changed date.

    CHANGELOG Version 2.1, 17.11.2018. - Repackaged the plugin for comatibility with Notepad++ v7.6 (new plugin loader). - Renamed WedEdit.dll to WebEdit-ansi.dll. - Renamed WedEditU.dll to WebEdit.dll. Version 2.1, 31.03.2010.

    Looks like the 2018 change was just to the packaging/zipfile and DLL name, with no change to the compiled DLL since the same revision number in 2010. In other words, it’s the same plugin that it was in 2010.

    Glad you found/fixed the edited ini file.

  • How do I replace two <br> tags?

    7
    0 Votes
    7 Posts
    535 Views
    Scott NielsonS

    @Terry-R Thanks a lot! I had leading white spaces in some files and so, I used this in the “Find” field: (?s)^\s*<p class=MsoNormal style=.+?mso-ansi-language:EN-US'>-

  • 0 Votes
    16 Posts
    2k Views
    guy038G

    Hi, @grimaldas-grydas and All,

    To begin with, let’s me explain the general method used. we’re going to use a short line, from your INPUT text, which must be processed :

    pppp={ 50350929 168.36935 33589252 }

    The goal is to write the three numbers 50350929, 168.36935 and 33589252 , each one on a different line, and prefixed with the string pppp, located before the = sign, in order to get :

    pppp=50350929 pppp=168.36935 pppp=33589252

    The problem is that when the regex engine catches, successively, each number, it does not know anymore the pppp string, located at the beginning of current line !

    So my idea was to swap the list of numbers and the string pppp before the equal sign and separate these two ranges with a temporary char, not present in your data !

    So, after a first regex S/R, we get the temporary text, below :

    50350929 168.36935 33589252¤pppp

    With this new layout, when the regex engine matches a number ( integer / decimal ) it is fairly easy, with a look-head structure, to store, at each time, the string after the temporary ¤ char, ending the current line !

    Then, with a second regex S/R, we finally get our expected text :

    pppp=50350929 pppp=168.36935 pppp=33589252

    Before we get into the details, it is IMPORTANT to point out that I found out a case where my previous regex S/R did not work ! So, you’ll have to use the second version, below !

    The complete regex S/R, where I added the \h* part that you mentioned and where I fixed the bug, is :

    SEARCH (?-s)^\h*(\w+)={(.+)\h+}$|(^)?\h+(\d+(?:\.\d+)?)(?=.*¤(\w+))|¤.+

    REPLACE (?2\2¤\1)?4(?3:\r\n)\5=\4

    can be split into 2 consecutive regex S/R, which are completely independent :

    The Search/Replacement A, which creates the intermediate text :

    SEARCH (?-s)^\h*(\w+)={(.+)\h+}$

    REPLACE ?2\2¤\1

    The Search/Replacement B, which gets the expected and final text

    SEARCH (?-s)(^)?\h+(\d+(?:\.\d+)?)(?=.*¤(\w+))|¤.+

    REPLACE ?4(?3:\r\n)\5=\4

    The groups, defined by the A and B search regexes are :

    (?x-s) ^ \h* (\w+) = { (.+) \h+ } $ ¯¯¯ ¯¯ Gr 1 Gr 2 (?x-s) (^)? \h+ ( \d+(?: \. \d+ )? ) (?= .* ¤ (\w+) ) | ¤ .+ ¯ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯¯ Gr 3 Gr 4 Gr 5

    Note, that I use the free-spacing mode (?x) for a better readability and each regex contains the (?-s) in-line modifier which means that any regex . char will match a single standard character ( not EOL ones )

    In search regex A :

    The part ^\h*(\w+)= matches the word string, stored as group 1, after possible leading blank chars, till an = character

    The part {(.+)\h+}$ matches a literal { char, then any non-null range of chars, each number preceded with space(s), which is stored as group 2, till space char(s) and a closing } char, ending the current line

    In replacement regex A :

    ?2\2¤\1, which should be exactly expressed as (?2\2¤\1), is a conditional replacement syntax, which means that IF group 2 exists, it must rewrite the group 2 first, \2( i.e. the numbers only ), then the literal char ¤ and finally group 1 ( the string pppp )

    Now, the search regex B contains two alternatives :

    The first alternative (?-s)(^)?\h+(\d+(?:\.\d+)?)(?=.*¤(\w+))

    The middle part (\d+(?:\.\d+)?) matches any integer or decimal number, which is stored as group 4. Note the optional non-capturing group (?:\.\d+)? in the case of a decimal number

    The first part (^)?\h+ matches matches the blank char(s), preceding a number. Remark that, if the leading blank char(s) begins current line, the optional group 3, (^)?, is then defined

    The final part (?=.*¤(\w+)), is a look-ahead structure, not included in the final match, but which must be true in order to get an effective match. So current matched number must be followed by a range, possibly null, of characters till the temporary char ¤ and the ending string pppp

    The second alternative ¤.+, which is used when current parsing position of the regex engine is at the ¤ location, after the processed numbers. This second alternative, without any group, simply matches the temporary ¤ char and all subsequent chars of current line, and should be deleted in replacement !

    In replacement regex B :

    ?4(?3:\r\n)\5=\4, which should be exactly expressed as (?4(?3:\r\n)\5=\4), means that, IF group4 exists ( the numbers ), it must :

    Execute, first, the (?3:\r\n) conditional replacement. This replacement does not include a THEN part and, only, the regex \r\n as an ELSE part, after the : char. So, this means that if group 3 does not exist ( number not at beginning of current line ) , it must insert a leading line-break !

    Write the group 5, \5, followed with a literal = sign

    Finally, write the group 4 ( current number matched by the first alternative of search regex B )

    Note that, when matching the second alternative ¤.+ of the search regex B, at end of current line, group 4 is not defined. So, no action occurs in replacement. Thus, concretely, this means that the string ¤pppp is deleted !

    Remarks :

    The S/R A and B are independent. As a demonstration :

    When executing, first, the search regex A, as no ¤ character already exists, each alternative of the search regex B cannot match

    When executing, in a second time, the search regex B, as the intermediate text ( after running A ) does not contain any { nor } characters, obviously, the search regex A cannot match, too !

    Thus, we can merge these two successive S/R in one regex S/R only ! You’ll note that :

    The redundant part (?-s), at beginning of regex S/R B, is omitted

    The replacement of S/R A, ?2\2¤\1, must be enclosed between parentheses, (?2\2¤\1), in order to not include the replacement section of S/R B

    As a conclusion, the complete regex S/R, with the free-spacing mode in the search part, is :

    SEARCH (?x-s) ^ \h* ( \w+ ) = { ( .+ ) \h+ } $ | (^)? \h+ ( \d+ (?:\.\d+)? ) (?= .* ¤ ( \w+ ) ) | ¤ .+

    REPLACE (?2\2¤\1)?4(?3:\r\n)\5=\4

    And outputs the expected text, after two consecutive clicks on the Replace All button !

    As mentioned in my last post, if we try to click a third time on the Replace All button, luckily, nothing else occurs ! Why ? Easy : as brace { or } characters nor ¤ character exists in our final text, any alternative of the overall regex cannot match. Logical ;-))

    I just hope, @grimaldas-grydas, that these explanations help you a bit !

    guy038

  • Macros with icones

    5
    0 Votes
    5 Posts
    491 Views
    EkopalypseE

    @Cyrille-Piatecki-0

    First install Customize Toolbar via the plugin admin page.

    b4755b54-85a1-45ed-b8e3-6561386dd29b-image.png

    Once done, goto plugins->customize toolbar

    4baf50e1-8847-4065-8db0-2392749c8080-image.png and check custom buttons

    This will create the needed configuration file.
    Goto plugins->open plugins folder... and move into the config directory from the newly created explorer window.
    There you will find the CustomizeToolbar.btn
    Open it and you will see examples how this needs to be done.

    For example:

    52d5099f-3115-4f8d-87eb-e645b8b4dfc4-image.png

    More info on how this works is available via the CustomizeToolbar plugin menu.

    The hammer symbol, on the far right in the menu, is used when no custom icon has been provided.

  • Adding to the Context Menu a Plug in .dll?

    2
    0 Votes
    2 Posts
    374 Views
    EkopalypseE

    @Mick-Peters <Item PluginEntryName="JSON Viewer" PluginCommandItemName="Format JSON"/>

    e0680666-0007-4f29-a2ef-ca727442162c-image.png

  • Windows CMD cannot find Python Script path

    2
    0 Votes
    2 Posts
    210 Views
    EkopalypseE

    @Haleymiranda79 - to me it is not very clear what you try to achieve. Do you use the python script plugin
    available via the plugin admin or a local python installation downloaded from python.org?
    What is your general goal? Writing python code within Npp and execute it via something else? Or from within Npp?
    Or something different?

  • What is the Setting for automatic saving of new files in notepad++?

    2
    0 Votes
    2 Posts
    122 Views
    Haleymiranda79H

    I think you save it with the extension .py. Your problem might be more complex than that. Do you mean “auto” as in that it saves without you having to click “save as”? Kinda like your emails save drafts periodically? I probably should not have gotten involved. Sorry if I confused you more.

  • paste time stamp to each word of a line

    10
    0 Votes
    10 Posts
    1k Views
    params16P

    @PeterJones Got the result as expected. Thank you!

  • Hilfe bei Korrektur der Groß / Kleinschreibung benötigt

    15
    0 Votes
    15 Posts
    720 Views
    PeterJonesP

    @Atlan1000 said in Hilfe bei Korrektur der Groß / Kleinschreibung benötigt:

    Through your solution I have learned a lot - especially how a positive lockbehind works!

    Glad to help.

    Other References:

    This Community Forum’s Regular Expression FAQ The official NPP Searching / Regex docs
  • Auto highlight folding close in a UDL

    2
    0 Votes
    2 Posts
    275 Views
    PeterJonesP

    @Phred-Doolittle said in Auto highlight folding close in a UDL:

    I want to know if there’s a way to highlight the corresponding End when I click on the Begin.

    Unfortunately, I do not think there is a way to do that. That behavior is controlled by the Settings > Preferences > Highlight Matching Tags feature in combination with the HTML or XML lexer being selected; there isn’t a similar feature in the UDL.

    It’s more subtle, but the code-folding does show some highlighting:
    inner block: 15789a45-a42e-4912-b3cb-132ee32dfede-image.png
    outer block: 102984f4-91d9-4d1f-a1a3-d17a7d907dbe-image.png
    Notice that the red fold lines are red for the active section, and are grey for the inactive section

  • 0 Votes
    5 Posts
    926 Views
    Kari LabermoK

    Hi guy038

    It worked like a dream

    Many thanks

    Kari Labermo

  • V8 always using 14% CPU even with one empty tab

    3
    0 Votes
    3 Posts
    272 Views
    Murilo RibeiroM

    @Ekopalypse Thanks for the info! I did see a bunch of things related to notepad++ with this monitor tool, but nothing out of the ordinary, then again, I don’t really know how to use it.

    The solution I’ve found so far was to install the latest 32 bit version. It simply works without the funny CPU behavior.

  • Replace specific part of the line AFTER the match

    6
    0 Votes
    6 Posts
    1k Views
    EkopalypseE

    @Hynek-Kalhous - no problem, happy to help. :-)

  • How to convert IDL User Defined Language into Dark Mode?

    2
    0 Votes
    2 Posts
    856 Views
    PeterJonesP

    @Amit ,

    UDL colors don’t inherit much from the chosen theme. If you want a UDL to match the colors of your theme, you have to edit the colors in the UDL. This is documented behavior.

    Also, see my answer about 6 hours ago from a similar thread.

  • Status line is bad when changing the encoding with shortcut.

    3
    0 Votes
    3 Posts
    185 Views
  • Dark Mode inverts texts after saving.

    5
    0 Votes
    5 Posts
    2k Views
    Johan DeGreyzeJ

    @PeterJones
    Hi Peter, thank you very much for all this effort to help me. You succeeded, I found why it looked like that.
    I use this program for years as a better replacement for the Microsoft Windows Notepad. In the past I did some HTML work with the BBC code and it was set to that language. I never noticed the normal text setting until now.
    So I set it to normal text and everything looks like it should.
    Problem solved, so again thank you for the effort.
    Best regards.

    Jan

  • Help needed with Search and Replace

    2
    1 Votes
    2 Posts
    164 Views
    astrosofistaA

    @Sandra-Treffers, All

    You were close. One way to solve it is the following regex:

    Search: (<Document) number="[\d]+"> Replace: $1>

    Put the caret at the very beginning of the document, select the Regular Expression mode and click on Replace or Replace All.

    Hope this helps.