• Regex with unexpected repeat application

    4
    0 Votes
    4 Posts
    336 Views
    Terry RT

    @Coises said in Regex with unexpected repeat application:

    Most likely the original poster has Settings | Preferences… | Searching | Replace: Don’t move to the following occurrence unchecked (I believe unchecked is the default), and is literally repeating both Find Next and Replace.

    I never knew that setting was there and was trying to figure out why he had a different result to me. Thanks, good to know there are still some things to learn about NPP.

    Terry

  • How to find string in range?

    8
    1 Votes
    8 Posts
    412 Views
    PeterJonesP

    @Hardik-Shah

    10.116.10.0 - 10.116.10.31
    10.116.10(0[0-2]|1\d|3[0-1])
    what I am doing wrong

    First, . means “match any character”, so that’s not what you mean. You should use \. to match a literal dot character.

    Second, you didn’t have a dot at all between the 10 and your group, so you are effectively looking for 10.116.10 followed by two more digits (with restrictions), but not looking for a dot in between. Your group say that it wants to match:

    either 0 followed by 0 or 1 or 2 or 1 followed by any digit or 3 followed

    Thus, you are trying to match

    10.116.1000 - 10.116.1002 or 10.116.1010 - 10.116.1019 or 10.116.1030 - 10.116.1032

    ----

    10.116.15.32 - 10.116.15.63
    search 10.116.15(3[0-2]|1\d|6[0-3])

    Again, you are missing the backslash before all the dots, and you are missing the dot between 15 and the final. And that one will thus match

    10.116.1530 - 10.116.1532 10.116.1510 - 10.116.1519 10.116.1560 - 10.116.1569

    And you haven’t told the regex anything about the .40-.49 or .50.59 range, so you cannot very well expect those to match (even if you fix the other problems)

    Hopefully, this explanation for why your attempts didn’t work, combined with @Coises earlier explanation, will help you understand where you are going wrong.

    If you cannot figure it out, the next time you show an example, and what you tried, also try to explain why you think it will work (explaining what every character or group of characters in the regex is doing), and we can then tell you why your explanation is wrong.

    But, as you have found, regex is not an easy way to find values within a mathematical range, especially for something complicated like an IP address. Every time you want to change the range, you will have to completely reconfigure your regex, and that’s going to get annoying for you. If you were using a programming language that had a library that can parse/understand IP addresses (any language worth its salt will have such a library), you could much more easily find IPs withing ranges, rather than relying on making a new custom regex for every range you want.

  • Directory under "Find in Files"-Search do not remember last folder

    3
    0 Votes
    3 Posts
    246 Views
    Alan KilbornA

    There really is no good reason for the Directory box to be auto-populated with the notepad++.exe folder in the case where Find in Files is invoked when a soft-named tab is currently active, thus I’ve created an ISSUE for it (I don’t consider it a bug, just an undesirable).

  • Through the title bar ?

    10
    0 Votes
    10 Posts
    2k Views
    E

    @xomx Thanks! That worked!

  • How to remove duplicate words in a list that are not consecutive?

    8
    0 Votes
    8 Posts
    872 Views
    Alan KilbornA

    @Debojit-Acharjee said:

    I can use script but I want to know why the “Remove Duplicate Lines” feature of “Line Operations” in Notepad++ doesn’t work when there are more than 30 thousand lines? Is there any thing to do with the CPU register memory?

    The best way to explore this is to create an “issue” on the official bug reporting site (see HERE for info on that) and attach the 30K+ file where it fails.

  • Yet another plugin admin does not install any plugins topic (OneDrive?)

    2
    0 Votes
    2 Posts
    172 Views
    rdipardoR

    Your OneDrive is a usually protected folder so the Windows OS will block any executable files from running in there.

    Check if your portable installation’s *.exe or *.dll files have the so-called Mark of the Web on them.

    You can use either Powershell:

    Get-ChildItem -Recurse -Include "*.exe","*.dll" | % { Get-Item $_.FullName -Stream "Zone.Identifier" -ErrorAction SilentlyContinue }

    or the Command Prompt:

    dir /S /R | findstr /R ".*exe:Zone\.Identifier:\$DATA .*dll:Zone\.Identifier:\$DATA"

    For each of the files that turn up, right-click with the mouse, select Properties, click Unblock, then Apply:

    motw

  • 0 Votes
    6 Posts
    484 Views
    GabrielPG

    @mkupper this worked great, thanks!
    9cdd4325-e8f6-40fa-9a85-d684b18cb503-image.png

  • Get my UDL to be listed in the style configurator

    3
    0 Votes
    3 Posts
    190 Views
    J

    @PeterJones
    Thanks for the quick response and explanation!

  • Solution for " Windows notepad corrupted by notepad++"

    2
    0 Votes
    2 Posts
    588 Views
    PeterJonesP

    @JimFingDandy ,

    You are incorrect. I have run the Notepad++ v8.6.3 installer, and do not have those registy settings that you mentioned. Nor do I have a c:\Windows\NotepadStarter.exe executable in my filesystem.

    But since your screenshot shows c:\Windows\NotepadStarter.exe, I am wondering whether at some point, you installed the “plugin” called NotepadStarterPlugin
    9dc94558-16de-4fec-bbb6-e664550d8562-image.png
    If you look at that plugin’s repo, changing those keys in the registry is exactly what it claims to do.

    update: Also, if you had read the full discussion that you linked to for your reply, you would have seen that the NotepadStarterPlugin was already identified as the likely culprit 7 years ago.

  • Syntax highlight % and %% lines differently

    5
    0 Votes
    5 Posts
    301 Views
    PeterJonesP

    @jnbearon said in Syntax highlight % and %% lines differently:

    @Ekopalypse
    I have a problem in that I am already short of Delimiter defs as the language definition form only allows 8 to be set. That then prompts 2 further questions:

    Can I define more than 8 delimiters - by editing the XML file?

    No. The number of colors is compiled into the program, and cannot be changed by a config file.

    Can I assign more than 1 delimiter to a particular colour? (I would be quite happy to bundle a few of the less often used ones into a single colour, but have the more popular ones having their own specified coloured line.

    Yes. You can see an example of this in the “Markdown (preinstalled)” UDL that ships with Notepad++:

    080344fd-fb48-40e5-9ed4-c2a91c9deb6e-image.png

    Just put the space-separated list of open and the space-separated list of close in the same order

  • 0 Votes
    2 Posts
    321 Views
    xomxX

    Known issue, Notepad++ is not a per-monitor DPI aware (V2) app yet. It is a GDI-app, so it needs additional coding to fix such issues.

    Here user reported a successful workaround:
    https://github.com/notepad-plus-plus/notepad-plus-plus/issues/14337#issuecomment-1835791674

  • Replace between two line

    7
    1 Votes
    7 Posts
    390 Views
    guy038G

    Hi, @zoltán-toldi, @coises, @alan-kilborn, @mark-olson and All,

    My previous regex may even be shortened as :

    SEARCH (?-i)^(\t+)(.+?)(\{(?:[^{}]++|(?3))*\})

    REPLACE $1$2{\r\n$1}

    To better understand this second search regex, we can use the free-spacing modifier (?x). Then, the search regex becomes :

    (?x-i) ^ ( \t+ ) ( .+? ) ( \{ (?: [^{}]++ | (?3) )* \} ) 1-----1 2-----2 3-----------------------------3

    So, after finding some leading tabs \t+ and the shorter text .+?, till an opening brace \{, the regex tries to match, either :

    An atomic group of characters, different from an opening and closing braces, followed with a closing brace

    An other group of characters ( the group 3 ), starting with an opening brace \{, which, in turn, can be followed with :

    An atomic group of characters, different from an opening and closing braces, followed with a closing brace

    An other group of characters ( the group 3 ), starting with an opening brace \{, which, in turn can be followed with, either :

    and so on …

    Note that the third group 3 is called, from within the group itself, with the recursive back-reference (?3).

    When a group x is called from inside its own group x, thanks to the (?x) syntax, this always defines a recursive regex !

    Note also that the use of the recursive (?0) syntax would refer to the whole regex $0

    You can control the depth of the recursion by using the {0,x} syntax, instead of the *, after the ending parenthese !

    Just try, against my INPUT example, the following values :

    {0,1} {0,2} {0,3} {0,4}

    You can verify that, with my example, the {0,4} is enough to cover all the cases. Of course, the * quantifier covers an infinite depth of recursion !

    BR,

    guy038

  • Change this gray color bit

    2
    0 Votes
    2 Posts
    177 Views
    Alan KilbornA

    @Jake-Dorr said in Change this gray color bit:

    Where can I change the coloring of that so it matches the orange/gray colors?

    Adjusting settings here (especially Top) will be the best you can do:

    4c2d746d-be24-4870-a6f4-c53d9e840d80-image.png

  • How to remove all data?

    8
    0 Votes
    8 Posts
    2k Views
    Alan KilbornA

    @jasoncom said in How to remove all data?:

    If the real portable version of Notepad++ is unzipped on an external USB flash drive (USB thumb drive) or an external hard drive, does it mean that the real portable version of Notepad++ will not leave any data in the computer (e.g. C:)?

    I believe that is a true statement.

  • Macro - copy and paste part of line

    9
    0 Votes
    9 Posts
    546 Views
    Martin SteinerM

    @Terry-R
    I’m sorry, I probably didn’t express myself very accurately the first time, it could also be the language barrier. However, your help brought me to my goal and now I have two macros that fulfill exactly what I needed and it’s to your credit. Thank you again for your time. :-)

    <Macro name="CopyMIX" Ctrl="no" Alt="no" Shift="no" Key="0"> <Action type="0" message="2345" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="(?&lt;=\t)([^\t\r\n]+)$" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1702" wParam="0" lParam="512" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1" sParam="" /> <Action type="0" message="2178" wParam="0" lParam="0" sParam="" /> <Action type="2" message="0" wParam="42002" lParam="0" sParam="" /> </Macro> <Macro name="CopyUnity" Ctrl="no" Alt="no" Shift="no" Key="0"> <Action type="0" message="2345" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="(?&lt;=\t)([^\t\r\n]+)(?=\t)" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1702" wParam="0" lParam="512" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1" sParam="" /> <Action type="0" message="2178" wParam="0" lParam="0" sParam="" /> <Action type="2" message="0" wParam="42002" lParam="0" sParam="" /> </Macro>
  • folder as workspace

    2
    0 Votes
    2 Posts
    148 Views
    Terry RT

    @zeta-orionis
    It’s referenced in the online manual here.

    Terry

  • subscripts

    29
    1 Votes
    29 Posts
    9k Views
    Mark OlsonM

    @Coises said in subscripts:

    The problems you are having are likely to plague those who read your files, too. As I mentioned earlier, it seems likely to me that there is a better way to approach your task. Using Unicode superscript and subscript numbers is usually not a good way to present material in which the superscripts and subscripts are important.

    @Эндрю-Ципихович
    Coises is correct. I would use LaTeX or MathJax to make a document with superscripts and subscripts.

    For example, if I wanted to make

    144689bd-4a9b-4e74-afe1-209c219f6fdf-image.png

    I would write this and use MathJax to render it.

    \log_{10}(x^2) = \sin(y)

    That’s only a tiny fraction of what is possible with LaTeX and MathJax. You can make some very impressive-looking documents from a simple plain-text document once you’re familiar with it.

    But I’m not going to talk any more about LaTeX or MathJax here, because that would be off-topic for this forum.

  • 1 Votes
    4 Posts
    355 Views
    CoisesC

    @mkupper said in Notepad++ Regex to find files having more than 2 words but should exclude certain word:

    It turns out that the not scanner, (?!word3a|word3b) only works on lines, not files, even if you try ``(?-s)(?!word3a|word3b).

    You’re misunderstanding what is going wrong. The expression you gave says, “Match null here if the following characters aren’t either word3a or word3b.” That matches at every position in a file except immediately before word3a or word3b. (Each line is listed once in the search results, but look at the number of hits.) What is needed is (?s)\A(?!.*(word3a|word3b)), which says, “Match null at the beginning of the document if the following characters don’t match any number of arbitrary characters followed by either word3a or word3b.”

    When I tested the whole expression I got some erratic results when I had it match null, which is why I set it to match the string from the beginning up to the word word1.

  • Macro works normally, but fails when shortcut is Ctrl+Shift+C

    8
    1 Votes
    8 Posts
    1k Views
    Mike NewmanM

    @mkupper Just following up here, as I finally got this working correctly. It was indeed another app (Webex in my case) capturing the shortcut first. I typically don’t like to download third-party apps (fourth-party?), but I gave Hotkey Detective a try, and it led me to the culprit.

  • 0 Votes
    10 Posts
    14k Views
    Rayran BritoR

    @Munter-Göök said in How can I find strings between "(" and ")" with any number of characters in between?:

    Thanks Alan! Now it works perfectly.
    The reason I couldn’t find out whyit’s working or not is that is my learning curve. I simply don’t have the time nor the experience needed to understand the syntax. So then I was crying out for help. Anyways this solved my problem and I am greateful.

    It would be nice if succesful solutions like this were to be found in some archive or why not implemented in N++.

    Thanks again!

    I appreciate @Alan-Kilborn for answering and @Munter-Göök for inquiring.
    I’m grateful that you guys were able to solve my problem! This demonstrates the forum’s significance to those who are facing similar issues. 🤜🤛