• XML Tools doesn't works

    3
    0 Votes
    3 Posts
    3k Views
    Benoit CoppensB

    @michael-vincent That fixed my issue. Thanks so much!

  • How to put parts of code...

    8
    0 Votes
    8 Posts
    929 Views
    Rafal Jonca 1R

    @peterjones

    It works very well, Peter. Thank you.

  • Pasting notes from Notepad++ to Microsoft Teams

    6
    0 Votes
    6 Posts
    1k Views
    PeterJonesP

    Yeah, the most important takeaway is that Teams doesn’t behave correctly when pasting from a plaintext-only clipboard – it doesn’t matter whether it’s our beloved Notepad++, or microsoft’s own notepad.exe, or any other texteditor on the market that I know of, which put the text into the clipboad: the fact that Teams doesn’t behave properly with plaintext clipboard is 100% a Teams problem.

    I think we’ve given enough things for the original poster to try to get around their problem, so they can continue to paste from Notepad++ through something else into Teams.

    At this point, if the OP has any more questions on other things to try, they should really go to a forum dedicated to Team or MS products or general computing.
    (In case my original statements weren’t clear, when I said “the issue is not a problem with Notepad++” and “we are not a Teams support forum”, that was supposed to be interpreted as "and thus, any further Teams-specific followon does not belong in this forum, as it is off topic.)

  • Regex error: (SyntaxError: invalid syntax) on Python Script Plugin

    5
    0 Votes
    5 Posts
    903 Views
    Robin CruiseR

    @rodica-F

    On complex regex, remember this:

    First, you must put \ before any ' in your regex. otherwise it will give conflict with the Python syntax that also have the operator '

    You had to remove the r after find : part. So, should be 'foo' instead of r'foo'

    In your default example should be (without : r in front of 'foo'

    { 'find' : 'foo', 'replace' : r'bar' },

    Your code, with the new and complex regex, should be like this.

    I write a second regex to see much better:

    # -*- coding: utf-8 -*- from __future__ import print_function from Npp import * import os import sys #------------------------------------------------------------------------------- class T22601(object): def __init__(self): Path="C:\\python-test" for root, dirs, files in os.walk(Path): nested_levels = root.split('/') if len(nested_levels) > 0: del dirs[:] for filename in files: if filename[-5:] == '.html': notepad.open(root + "\\" + filename) console.write(root + "\\" + filename + "\r\n") notepad.runMenuCommand("Encodage", "Convertir en UTF-8") regex_find_repl_dict_list = [ { 'find' : '<link (.*?)( rel=\'canonical\'/>)', 'replace' : r'<link rel="canonical" \1 />' }, { 'find' : '(<meta content=\')(.*)(\' property=\'og:description\'/>)', 'replace' : r'<meta name="description" content="\2" />' }, ] editor.beginUndoAction() for d in regex_find_repl_dict_list: editor.rereplace(d['find'], d['replace']) editor.endUndoAction() notepad.save() notepad.close() #------------------------------------------------------------------------------- if __name__ == '__main__': T22601()
  • Notepad ++ 8.3.3

    2
    0 Votes
    2 Posts
    360 Views
    rdipardoR

    Check the file version of both plugins against the tracking issue to make sure they’re compatible.

    8.3.3 (64-bit) also learned to intercept plugins whose versions are on the “black list”. This wouldn’t be the first time a user was unpleasantly surprised by the new “feature”.

  • 0 Votes
    12 Posts
    560 Views
    guy038G

    Hi, @Incrypt-_, @neil-schipper, @peterjones and All,

    I slightly modified my two regex S/R. So :

    Regarding — Pass 8 – Part 1

    SEARCH (?s-i)\QEXEC msdb.dbo.sp_add_job @job_name=N'\E(\w+).+?\K^---- END_OF_JOB

    REPLACE \1$0

    In the replacement, you can use the $0 syntax wich corresponds to the complete regex match, so the literal string ---- END_OF_JOB

    Regarding ---- Pass 8 – Part 2

    SEARCH (?-is)\QEXEC msdb.dbo.sp_add_jobstep @job_\E\Kid=@jobId(?=(?s:.+?)^(\w+)---- END_OF_JOB\R)|^(\w+)---- END_OF_JOB\R

    REPLACE ?2---- END_OF_JOB\r\n:name=N'\1'

    As in the previous regex, we search for word characters ( Letters, digits and underscore only, representing the job_name ), at beginning of line(s), right before the ---- END_OF_JOB string

    I also used the \K syntax, instead of the positive look-behind feature. Remainder : the \K syntax means that you must, necessarily, use the Replace All button ( the Replace button won’t work ! )

    Now, here is a full explanation of the provided regexes, in this last version :

    First search :

    At beginning the part (?s-i) are in-line modifiers which means :

    The text is seen as a single line. So the . regex symbol represents any single character ( Standard AND EOL chars )

    The text must respect the case ( -i means non-insensitive search )

    Then, the part \QEXEC msdb.dbo.sp_add_job @job_name=N'\E looks for the string EXEC msdb.dbo.sp_add_job @job_name=N’, with this exact case. Everything between the \Q and \E escape sequences is simply considered as literal text !

    Then the part (\w+) searches for, at least, one word character ( the job_name ) and stores it as group 1

    Finally, the part .+?\K^---- END_OF_JOB looks for the smallest range, .+?, of any char, till the string ^---- END_OF_JOB, beginning a line

    In addition, the \K syntax cancels any previous match, so far and resets the regex engine location. So, the final match is only the literal string ---- END_OF_JOB

    First replacement : the literal string ^---- END_OF_JOB is replaced with :

    The job_name ( The group \1 )

    Then, the string ---- END_OF_JOB ( $0 syntax, representing the complete searched match )

    Second search : it contains two independant searches :

    The regex search (?-is)\QEXEC msdb.dbo.sp_add_jobstep @job_\E\Kid=@jobId(?=(?s:.+?)^(\w+)---- END_OF_JOB\R)

    The regex search ^(\w+)---- END_OF_JOB\R

    At beginning the part (?-is) are in-line modifiers which stand for each alternative and mean :

    The text must respect the case ( -i means non-insensitive search )

    The text is not seen as a single line. So the . regex symbol represents any single standard character only ( not the EOL chars )

    Then, the part \QEXEC msdb.dbo.sp_add_jobstep @job_\E looks for the string \QEXEC msdb.dbo.sp_add_jobstep @job_\E, with this exact case. Everything between the \Q and \E escape sequences is simply considered as literal text !

    The \K syntax cancels any previous match, so far and resets the regex engine location. So the final match is only the literal string id=@jobId, but…

    ONLY IF a smallest range of any char ( ?s modifier restricted to the non-capturing group (?s:.+?) ) till a job_name, beginning a line, followed with the string ---- END_OF_JOB, with this exact case and its line-endings can be found further on, due to the look-ahead structure (?=(?s:.+?)^(\w+)---- END_OF_JOB\R)

    The last alternative ^(\w+)---- END_OF_JOB\R) simply looks for some word chars ( the job_name ), beginning a line, followed with the literal string ---- END_OF_JOB and its line-endings

    Second replacement : it uses a special Boost feature, called a conditional replacement :

    IF the group 2 exists ( so the second alternative ), the job_name, beginning a line and the string ---- END_OF_JOB, followed with its line-endings is just replaced with the literal string ---- END_OF_JOB and \r\n ( replacement part before the colon char )

    ELSE ( case of the first alternative ), the literal string id=@jobId, located after any EXEC msdb.dbo.sp_add_jobstep @job_ text, is replaced with the literal string name=N', followed with the group 1 ( the job_name ) and finally a ' char ( replacement part after the colon char )

    Best Regards,

    guy038

  • "Save As" Screen Very Slow To Load Windows 7

    2
    0 Votes
    2 Posts
    160 Views
    Terry RT

    @matt-m-0 said in "Save As" Screen Very Slow To Load Windows 7:

    Does anyone have any ideas of what I could try?

    Sorry this isn’t going to fix your problem, but do you have shares or remote drives connected, even cloud resources. Notepad++ could well be waiting on those remote resources to “wake up” before presenting the options for saving.

    Read this post.

    Your issue has arisen a small number of times in postings here, but there has never been a conclusive answer to “fix” the issue. Not that it’s actually an error, just the way the environment works around Notepad++.

    Terry

  • ENTERING [CRLF] into SEARCH and/or REPLACE

    3
  • How can I change the colors in the compare mode [Alt]+[c]?

    2
    0 Votes
    2 Posts
    1k Views
    PeterJonesP

    @heinz-berecz-0 ,

    Are you using the Compare Plugin? (It’s hard to tell, because its default “compare” keyboard shortcut is Ctrl+Alt+C, not Alt+C; … by default, Alt+C is mapped to the Column Editor dialog Edit > Column Mode)

    To change the colors in Compare Plugin v2.0.2 and similar, go to Plugins > Compare > Settings, and see the section called “Color settings”.

    0e755c86-6eed-4245-b2cc-d108eb00d70b-image.png

    524b7208-8bef-4e7a-a338-3fc5189772ea-image.png

    ccfd71a6-09f5-46b3-9a4f-dcc22ae4def4-image.png

  • 0 Votes
    15 Posts
    730 Views
    PeterJonesP

    @mm-john said in Alt+X is an undocumented/unreported keyboard shotcut for main menu file - close:

    Speculating, the &X would make it a npp shortcut and just “X” makes it a windows shortcut.

    Nope. When the developer prefixes a letter in the menu entry with the &, the developer is saying “Windows should use this letter as the accelerator key (if it can)”. It’s still Windows that is defining the behavior that Alt+Letter will open/activate that menu entry.

    &X would have it underlined all the time?

    In any situation in which case the F of File, E of Edit, … t of Settings, o of Tool, … are underlined, the X of X would be, too. If they had defined it as &X

    e9ad83a2-750d-4635-9f1d-37e479d5539b-image.png

    And, I’m guessing, &X would also make it appear in the Shortcut Mapper?

    Nope. Again, it’s not a “shortcut” from Notepad++'s perspective. It’s the Windows OS accelerator key for the menu entry. Notice for Windows that it doesn’t matter whether you type Alt+F to open the File menu or Alt then let go and pause, then hit F: it still opens the File menu in that sequence; and Alt, Pause, X will still close the active – that’s because it’s Windows OS handling the accelerator; it just tells Notepad++ “do whatever you’d do if someone clicked the File (or X) menu entry”. The Notepad++ Shortcut Mapper cannot define a keyboard shortcut that works that way; all Notepad++ keyboard shortcuts all must be simultaneously pressed, even if they have Alt in the shortcut.

    I am guessing there’s no way to have windows (os-level) shortcuts appear in the Shortcut Mapper.

    You’re right, because it’s not a shortcut; it is a menu accelerator, implemented by the OS, not by the application.

    Perhaps a note at the bottom of the Shortcut Mapper that says “additional shortcuts from the (windows) OS are active even tho they are not represented here. A shortcut here will override the OS.”

    Please, no. Way too much clutter. The windows accelerators are not shortcuts; they are accelerators, and they work that way in every single windows win32 api-based application that I have used since Windows 3.11, from what I remember. At this point in the windows history, if a user doesn’t know that Alt+letter activates a menu with that accelerator letter, no amount of clutter in a user interface will help with that. The next version of the user manual will attempt to clarify this, but it’s really a Windows default behavior that has worked that way for decades.

    Because of this discussion, I have added the paragraph listed above to the user manual repository, so on the next release of the manual, it will be easily accessible in the same place that the shortcut mapper itself is documented.

    I have portable, so the path to the shortcuts.xml is wherever the notepad++.exe is stored

    That’s well documented in the User Manual. I got tired years ago of typing in every response in this forum “shortcuts.xml in %AppData%\Notepad++ or wherever you happen to have placed your portable version, or in your cloud directory, or in the -settingsDir location”. If you are going to use something other than the standard installation, the onus is on you to understand how to translate the generic instructions into your specific configuration. If you had included the ?-menu’s Debug Info in your post, which would have told me that you had a non-standard installation, I would have customized my reply to your exact portable location. But barring that information being already transmitted to me, I will assume you have a standard installation. (And this despite the fact that for my entire workday every weekday, I am working out of a portable, and thus it’s more natural for me.)

  • Invoke find/replace with selection - selection box not marked

    12
    0 Votes
    12 Posts
    1k Views
    Alan KilbornA

    FWIW, and I don’t know why I didn’t mention this earlier, I wrote a PythonScript to handle this, and it is HERE.

  • #HELP ME..............................

    4
    0 Votes
    4 Posts
    442 Views
    PeterJonesP

    @eliot

    If you really have smart quotes in your data (doubful, but it’s what you posted):

    FIND = “priceMax”:\K\d+\.\d+ REPLACE = 0.1 SEARCH MODE = regular expression REPLACE ALL (because of \K, single replacement won’t work as expected)

    If you actually have ASCII quotes in the data

    FIND = "priceMax":\K\d+\.\d+ everything else the same

    ----

    Useful References Please Read Before Posting Template for Search/Replace Questions FAQ: Where to find regular expressions (regex) documentation Notepad++ Online User Manual: Searching/Regex
  • Custom XML syntax Highlighting? Custom XML UDL?

    14
    0 Votes
    14 Posts
    2k Views
    PeterJonesP

    To borrow an idiom from GitHub: 🚀

  • I did not receive the email from this forums to confirm my email...

    8
    0 Votes
    8 Posts
    738 Views
    MelchiorGasparM

    @peterjones said in I did not receive the email from this forums to confirm my email...:

    On the other hand, when I click on @MelchiorGaspar , it takes me to a 404-page-not-found error.

    And you don’t show up in the recent users list.

    Oh, that’s because you’ve had an account since 2017 (as I can see from searching on the users page for “melch”, which narrows the search down to
    065492fa-2045-4200-81a6-2f4f7958acde-image.png … so that explains why you weren’t in the new users.

    But it’s still strange that your profile seems to exist and you can post from it (and that at some point, you were able to set your avatar/profile picture), but that your profile doesn’t seem to be externally visible and returns 404. Someone with more power on the forum than me (maybe @guy038, if he’s around sometime soon) will have to take a look at your account to see what’s different about it.

    Given that I have confirmed that there is something wonky with your account specifically (given the 404), I will delete the dummy @e-pryrt account, since it’s not actually needed.

    I may have used a different login before… I thought I had an account here before… but could remember what I used to login… so I logged in with GitHub this time which imported my avatar and username…

  • Search and replace special characters ANSI-UTF

    5
    0 Votes
    5 Posts
    15k Views
    rodica FR

    I use this regex to find ANSI characters in all my documents:

    FIND: ¾|Ð|¼|°|Ñ|Ä|¢|º|ª|Å|Ÿ|ž|È|æ|Ã|¢|£|®|º|©|€|§|®|™|¢

    in almost all ANSI characters these signs are repeated: ¾|Ð|¼|°|Ñ

    But I use that longer regex, to make sure I don’t miss anything.

  • select language by name and not by extension

    12
    0 Votes
    12 Posts
    1k Views
    PeterJonesP

    @peterjones said in select language by name and not by extension:

    I think I will submit that as a bug report / feature improvement.

    Priority order on heuristic: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/11504

    UTF-16 BE/LE ignores heuristic: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/11505

  • Delete the entire content of all files with less than 100 words

    25
    0 Votes
    25 Posts
    1k Views
    rodica FR

    @guy038 said in Delete the entire content of all files with less than 100 words:

    \A[^\w]*(?:\w+[^\w]+){0,4}(?:\w+[^\w]*)?\z

    My joy is that, thanks to my regex, an alternative method has been discovered, quite good.

    thank you @guy038

  • Notepad++ link in SendTo Folder does not work any more

    4
    0 Votes
    4 Posts
    319 Views
    Alan KilbornA

    @susanne-senger said in Notepad++ link in SendTo Folder does not work any more:

    if I highlight some files (up to 8)

    Did you try with just ONE file? Does that work?
    (refer to Peter’s post where he says You also mentioned “a bunch of files”… which you clearly didn’t read…)

  • Notepad++ font

    2
    0 Votes
    2 Posts
    156 Views
    dfs-D

    Could you provide a screenshot illustrating the issue, so we can see where the cut-off happens?

    Do you have DirectWrite active in the Notepad++ preferences?

  • Theme creation: How to choose separate color for...

    5
    0 Votes
    5 Posts
    317 Views
    PeterJonesP

    @drawing-with-jakob-dam said in Theme creation: How to choose separate color for...:

    I’ve tried to copy the line to the HTML section and given it a unique styleID, but it didn’t work.

    Unfortunately, you cannot just arbitrarily copy XML from one language’s settings to another. Well, you can, but it won’t do anything.

    Each language’s lexer has its own bit of code that decides what will and what won’t be syntax highlighted; it reads the XML configuration for that language, and on the StyleID’s that it recognizes, it applies the styling defined by that line of XML to the sequences that match what that lexer is coded to match for that StyleID… but if you define a StyleID that the lexer doesn’t recognize, it won’t do anything with that definition, because there is no line of code in the lexer that does anything with that StyleID.