• Help with search and replace regex

    7
    1 Votes
    7 Posts
    1k Views
    Alan KilbornA

    It is good that a solution here helped out the OP, but as I read the problem statement, it struck me that, although sample data was provided, perhaps the larger data set doesn’t always conform to the key parts of the sample. Only the OP knows this (or could know it by looking at more of his data set). People proposing solutions wouldn’t know it, so they may “key off” of some things that aren’t true in the larger data set.

    I guess my basic point is that OP should really look hard at his data set and make sure that the solution chosen really does what is intended for all of the data set. This is somewhat obvious, but it is easy to “grab and go” with a solution, and then find out later that you haven’t covered all cases, or worse, you’ve irretrievably corrupted your data.

    It always seems easier to “trust” someone else’s solution is good for your problem. (Think about “code-grab-and-go” from a stackoverflow solution.) When you’re developing your own solution, you tend to look at things with a closer and more-critical eye.

    Of course, if a problem with the data conversion is noticed down the road, OP could come back here and “complain” that the solution was deficient, to be told that the solution was adequate for the sample data and problem description.

  • New line is not at start of line?!

    3
    0 Votes
    3 Posts
    463 Views
    Autperformance ChrisA

    @Alan-Kilborn had to change the language to english so i could follow your steps and then found the thing - there were 3 options in line wrap: Default, Aligned and Indent - i don’t know why but it was on Indent, changed it to Default and now it works like it was before, thank you very much!

  • Deploy Notepad++ on Teams for text docs

    4
    0 Votes
    4 Posts
    2k Views
    PeterJonesP

    @MHUnmann ,

    Sorry I misunderstood. I had no idea that Teams could be used to deploy software. I am just an ordinary-to-middling user of Teams, and know nothing about its superpowers.

    If the Teams-based deployment is similar to the Intune-based deployment (I haven’t read the articles you linked to, and know virtually nothing about either), then I’ll say to you something similar to what I said a few minutes ago in another conversation: the regulars here aren’t necessarily experts in things like Intune or Teams administration; however, in this discussion, the user there showed an example script presumably used somehow in Intune to install Noteapad++ and some plugins; that script might be a starting point for you, depending on how similar the Intune and Teams procedures are.

  • Notepad++ intune install

    2
    0 Votes
    2 Posts
    4k Views
    PeterJonesP

    @Sam-Martens ,

    We occasionally get Intune questions here, but I don’t know that any of the regulars has experience on the Intune admin side of things.

    That said, this discussion from a few months ago shows that user’s script for installing plugins. (And also some of the gotchas about directory permissions when you use such a script.) But it might give you a starting point.

  • Trim LDAP extract

    7
    0 Votes
    7 Posts
    2k Views
    Olivier ChantraineO

    @PeterJones said in Trim LDAP extract:

    @Olivier-Chantraine said in Trim LDAP extract:

    and it work well (for marking only)
    but , if i replace, the regex erase all “CN=text,” in the same line

    That’s because after the substitution, the next CN=text, is the first CN=text, on the line, and it will match again.

    I think what you want is
    FIND = (?-s)^CN=.*?,(.*)$
    REPLACE = ${1}

    That will delete the first CN=..., on each line, leaving the rest of the line intact.

    ----

    Useful References Please Read Before Posting Template for Search/Replace Questions Formatting Forum Posts Notepad++ Online User Manual: Searching/Regex FAQ: Where to find other regular expressions (regex) documentation

    Ty, its working :)

  • how to reopen same file from taskbar without using backup option

    3
    0 Votes
    3 Posts
    566 Views
    Terry RT

    @Shekhar-Singh said in how to reopen same file from taskbar without using backup option:

    how can i reopen the same file by clicking on the icon on the taskbar without using the back up option …

    As Notepad++ (NPP) uses the same configuration settings each time it loads (by default) and the backup settings are stored in these configuration files you cannot achieve what you want (directly).

    However there is a command line argument (see ?, then Command Line Arguments…), look for -settingsDir=. I’ve never used this and have no idea on how well it might work for your need. However if it does it would mean you could specify an alternate set of configuration files for running NPP which have all those backup options turned off (at your risk). It would also mean you would have to create a second icon on the taskbar which has the command line parameters to suit this alternate option.

    Also read the announcement for v7.9.2 here which was when this option was implemented.
    The corresponding github page here has more background information.

    As for your second question, can NPP cause high disk usage? Possibly, if you have a lot of large text files loaded and the backup settings set to a low value (backup every xx seconds).

    I should at this point reference the online manual and the information about backup here
    Also you should read one of the FAQ posts called Periodic Backup vs AutoSave Plugin here.

    There has been much debate over which settings are best, and in the end it really depends on what you prefer and what you can afford to lose if the application (or PC) crashes.

    Terry

  • Community Forum Search Results

    4
    0 Votes
    4 Posts
    297 Views
    JeronymiteJ

    @PeterJones Many thanks, Peter! Should have seen that.

  • New ILexer interface from PythonScript

    10
    2 Votes
    10 Posts
    2k Views
    Michael VincentM

    @rdipardo said in New ILexer interface from PythonScript:

    before the Python host is even ready to execute scripts.

    @Bas-de-Reuver

    Both are correct. However, PythonScript offers enough in the form of API and callbacks that we can access the compiled lexers and by reading in a config file (langs.hidden.xml) and stylers file (stylers.hidden.xml) based on their “.model.xml” versions, we can get pretty decent lexing for “non-standard” languages, including (ones I’ve tried):

    Stata Julia X12 Edifact BibTeX F# Raku

    Thanks to @PeterJones for his code pointer above in this thread which I highly modified to get to this solution.

    PS: If you include the GlobalStyles tag in the “hidden” stylers file, you can actually select it in the Style Configurator and make changes. The changes are not effective immediately, you need to save and then use PythonScript to .reload_lexer(), but the slight inconvenience of 2-step process for the few times I’ll do this … no big deal.

    ab0c1ac8-b248-46fb-9b08-336c6e9b194b-image.png

    Thank you all!

    Cheers.

  • How to have colored and numbered blocks?

    2
    0 Votes
    2 Posts
    523 Views
    PeterJonesP

    @Diego-Giurgola ,

    The colored blocks shown there are the “Change History” feature, which requires v8.4.6 or newer. So those line colors in the margin will change based on which lines have been changed or saved since you started editing the file.

    They are not an “attribute” that you can set, so you cannot say, “in file1.txt, I want lines 1-7 to have a green margin and 8-12 to have an orange margin”, so the feature that you are seeing will not do what I think you want.

  • UDL for .BAT or .CMD files

    2
    0 Votes
    2 Posts
    262 Views
    EkopalypseE

    @Christophe-MERCEY

    Probably not, since there is a built-in lexer.

    language menu:

    0e8bb8bf-0a5c-4dbe-8e6d-fcb0a9f07bb4-image.png

  • Default Find button

    3
    0 Votes
    3 Posts
    487 Views
    Alan KilbornA

    @Amazon-Books said in Default Find button:

    How can I make this “Find All in Current Document” button the default ‘Find’ button instead of “Find Next”?

    You can’t, at least not easily.
    I suppose what you want is to simply press Enter to have FACD happen.
    Suggest take @Lycan-Thrope 's suggestion and retrain yourself to hit Alt+d instead of Enter in this circumstance.

  • How to remember last opened position in Notepad++?

    2
    0 Votes
    2 Posts
    646 Views
    Alan KilbornA

    @dspjm

    That type of information is not remembered with the file (because the file is purely data, not metadata from use with a text editor). If you leave the file open, however, the N++ session file does remember this between runs of N++, and is what retains the caret position from run to run.

    The short answer to your question is “no”; the longer answer is that Notepad++ has scripting capabilities that could allow a script to be written to meet your desire.

  • UDL Number Suffix 2 not working when character also in Extras 2

    10
    1 Votes
    10 Posts
    2k Views
    Maggi 9295M

    @Ekopalypse said in UDL Number Suffix 2 not working when character also in Extras 2:

    @Maggi-9295 said in UDL Number Suffix 2 not working when character also in Extras 2:

    Just out of curiousity, is there some kind of documentation on this?

    I like the idea of having the configuration file and the help system in one place, and I hope the explanation is understandable. If this is not the case, let me know how I can improve it.

    I think it’s alright, no worries! I just wasn’t aware it uses the Notepad++ regex syntax and was searching which syntax it uses in the first place, but that’s just me not reading properly :P
    The Notepad++ documentation on searching is already more than comprehensive enough, so I think that should cover pretty much everything (once you got used to it, that is :P)

  • Shift Left, No Tabs

    15
    0 Votes
    15 Posts
    4k Views
    guy038G

    Hi, @alan-kilborn,

    Yes…, you’re right about it, Alan ! But how to get a simple behaviour ? Note that the macro is about deleting the first character, regardless its type !

    And, anyway, in your post https://community.notepad-plus-plus.org/post/83341, where you proposed the right regex method to delete the first 6 chars, they could be tabulation chars, as well ?

    BR

    guy038

  • 0 Votes
    2 Posts
    242 Views
    PeterJonesP

    @Random-Encounter ,

    UDL is not all-powerful: it focuses on defining a list of keywords, rather than arbitrary pattern matches, for syntax highlighting, so it cannot do what you want.

    However, the EnhanceAnyLexer plugin can apply the power of regex to change the foreground color of certain text; so you could install that plugin, define most of your language with the UDL interface; then, to get things to the left of an = to be a different color, use Plugins > EnhanceAnyLexer > Enhance Current Language, which will add or edit a section in its config file for your current language: the section will start with [NameOfUDLhere], and then consist of “color = regex” pairs (if the colors are in hex, it’s 0xBBGGRR for the blue, green, and red portions), along with a config line for “excluded_styles = …” which you probably don’t need to worry about)

    For my example, since I’m just using the dummy “Default Langauge” (which internally is labled as udf), I can use the following config section to get it to highlight text on the left of the = with brownish-orange:

    [udf] 0x66ad1 = ^.*(?=\=)

    42434862-d71d-4824-920a-b839722f7d37-image.png

  • Keys not being reognized

    2
    0 Votes
    2 Posts
    487 Views
    PeterJonesP

    @Larry-Schwartz ,

    There is nothing inherent in Notepad++ v8.4.7 or v8.4.8 that would reject those keys. My guess is that either you have something (AutoHotKey, or a rogue program, or malware or worse) that is intercepting those keys (maybe only sometimes, since they seem to work for MS products), or something was corrupted in your %AppData%\Notepad++\shortcuts.xml, which is where keyboard shortcuts are defined.

    To check the latter, the first step could be Settings > Shortcut Mapper > Scintilla Commands, then filter for HOME or END or the other keystrokes you mentioned, and see if they are still assigned to anything (or if they show up with a reddish background, which would indicate that some other command is also assigned to that keystroke, which could cause unexpected behavior)

    Alternately, you could exit Notepad++, delete/rename %AppData%\Notepad++\shortcuts.xml, and then restart Notepad++: it will recreate the shortcuts.xml file with default values, and it should go back to working normally. If not, then it’s most likely that some external application has hijacked those keys in a weird manner.

  • Quick way to mark columns using the keyboard

    3
    0 Votes
    3 Posts
    569 Views
    Joe BerryJ

    @Alan-Kilborn - This has the parts I was missing. Just tried it, now to develop a shortcut or macro! Thanks for your time and expertise.

  • Want REGEX to Check Every Line Indivdually

    6
    1 Votes
    6 Posts
    551 Views
    Alan KilbornA

    @kc270000 said in Want REGEX to Check Every Line Indivdually:

    Meant “at” typed ampersand. Thankfully Alan understood…

    Actually I think I glossed over ampersand and my eyes flew right to the non-working regex you provided – and I went from there quickly to the solution.
    :-)

    BTW, (maybe) the reason the OP’s regex cleared the entire document is that the regex didn’t contain anything to limit the match to each line. Typically this is done with (?-s) in combination with .* or .+ later in the expression. Without a ., and without any line-ending characters in the regex, it will match across lines and perhaps even consume the entire doc.

  • 0 Votes
    53 Posts
    11k Views
    PeterJonesP

    This discussion has stopped being about “new window” or about “shortcut keys”, and really ceased even being about Notepad++. And now it’s even attracting random posts as well.

    This topic is being locked. If anyone has Noteapd++ related discussion, a new topic can be started quite easily; if you need to, provide a link back to this discussion for reference.

  • macro to find/replace in current directory?

    4
    1 Votes
    4 Posts
    572 Views
    Alan KilbornA

    @rorso

    Cool that that technique can work for you. I had another idea which as “heavier” as it involved using a scripting plugin, so if that wouldn’t work out for you, I’d’ve gone down that road.