• Align Questions in One line.

    8
    0 Votes
    8 Posts
    564 Views
    Martin MartinM

    @PeterJones said in Align Questions in One line.:

    (?-s)^\u+).+\K\R(?!\u))(?!ANSWER)

    I don’t know how to express gratitude on the internet. But BIG THANKS. YOU SAVED ME A LOT OF TIME.

    Really. THANK YOU.

  • How to Find

    3
    0 Votes
    3 Posts
    275 Views
    Mr. Math ExpertM

    @Alan-Kilborn said in How to Find:

    (?-is)\bto\x20+\w+?ly\b

    Thank you, perfect.

  • cant read greek

    4
    0 Votes
    4 Posts
    1k Views
    John ConantJ

    @PeterJones Thank you for sharing this excellent answer with detail and links, very proactive and anticipatory!

  • Baffled by \R vs \r\n in Find: expression?

    10
    1 Votes
    10 Posts
    1k Views
    Hank KH

    @PeterJones
    Thanks for the GREAT explanation, will read manual again and experiment.
    You and Alan have a GREAT DAY !!
    Cheers, Hank

  • 0 Votes
    4 Posts
    227 Views
    bruce oliverB

    Now Fixed THANK YOU so very very much… YEA!!! have a good day.

  • Copying selected text with mouse+ctrl no longer works.

    3
    0 Votes
    3 Posts
    522 Views
    B

    @Alan-Kilborn

    Thanks, Alan. You’re a star!

  • 0 Votes
    5 Posts
    374 Views
    Joachim MüllerJ

    @Alan-Kilborn
    Cool! Thank you :)
    I will try :)

  • Macros dissapeared

    10
    0 Votes
    10 Posts
    1k Views
    Wolf GangW

    Had this exact problem.
    I just updated n++ using the built-in updater (to 8.6.2) and all my macros are gone, I had created 5… shortcuts.xml are empty (with defaults in them).

    39b3660e-2cd8-4860-9139-3c46893d29b5-image.png

    Also like 30 of previous entries in “Find what” drop down menu are gone… So now it makes really difficult to create my macros.
    6faaa499-db53-4e7c-be98-f7b4e77fd312-image.png

    Very disappointed…

    I use duplicati to make backups of notepad++ daily… And it seems macros were not even saved. I just restored from Notepad++/cloud folder and the file content is just the default one.

  • Regex - Finding Invalid Characters in HTML Tags

    8
    1 Votes
    8 Posts
    777 Views
    Sylvester BullittS

    @guy038 Wow. I feel like I’m sipping from a fire hose! I bow to far greater experience than mine. Here’s the regex I finally chose:

    (?-si:<(?:title|figcaption|h[1-6])>|(?!\A)\G)(?s:(?!</).)*?\K\xAD

    I like your idea of using the \xAD for the soft hyphen: It clarifies what the regex is doing!

    I ran the regex it against my entire Web site (16,000 HTML files), and it works perfectly.

    I’ll be the first to admit I don’t fully understand why it works, but I can’t argue with success. I’m going to have to study it for a while, but it now has a permanent home in my toolbox.

    Thanks for taking the time to look at this thorny issue!

  • Same line spacing with other view

    6
    0 Votes
    6 Posts
    775 Views
    CoisesC

    @PeterJones said in Same line spacing with other view:

    I haven’t been able to find a way to send a message to Scintilla (the library that Notepad++ uses for the doing the editor commands) to change the height of individual lines.

    “All lines of text in Scintilla are the same height, and this height is calculated from the largest font in any current style. This restriction is for performance; if lines differed in height then calculations involving positioning of text would require the text to be styled first.“
    https://www.scintilla.org/ScintillaDoc.html#TextRetrievalAndModification

  • collapse specified xml-Tags on file opening

    2
    0 Votes
    2 Posts
    409 Views
    PeterJonesP

    @HConBike ,

    In native Notepad++, no.

    If you installed the PythonScript plugin, then a script could be written (and run every time a file is opened with the specific extension you specified) to search for the Fonts block and fold that level.

  • Accidental open

    8
    1 Votes
    8 Posts
    434 Views
    mkupperM

    @Alan-Kilborn said in Accidental open:

    But clearly OP was having trouble getting rid of it.

    That’s part of what seems like the bug I mentioned earlier. I started to write up the issue but it is turning into a long post plus I realized there were hints in the github issues that it has been reported, so I’ve parked the bug report it pending review, testing, and thinking.

    If someone does Ctrl+Tab or Ctrl+Shift+Tab to bring up the document switcher and you then while holcing Ctrl down you type Esc to exit document switcher the Ctrl+Esc or Ctrl+Shift+Esc are sent to Windows. Ctrl+Esc brings up the start menu and Ctrl+Shift+Esc activates task manager. That’s issue one.

    If you then switch back to Notepad++ you’ll see the document switcher dialog box but can’t get focus onto it other then via the mouse. Thus the box can appear to be stuck in the way. That’s issue two. The document switcher dialog box is model which means Notepad++ itself is locked up. It’s not a crisis as you mouse click within the box and it’ll activate the tab you happened to select via the dialog box.

    You can also trigger the second issue’s behavior by Ctrl+Tab and while holding the Ctrl key down you click on the task bar to bring another application the foreground. When you switch back to Notepad++ you’ll be moderately stuck with the document switcher. It turns out that pressing and then releasing Ctrl will clear the document switcher.

    github issue 10950 seems to describe what I saw but at the time that issue was raised it also seemed to be intermittent or hard to reproduce.

  • Select all marked text

    15
    0 Votes
    15 Posts
    8k Views
    Tomasz SałekT

    @Coises said in Select all marked text:

    In quoting you, it appears that you meant your regular expression to be ^\d+/\d\t; but it didn’t come out that way, because the asterisks were interpreted as signaling italics and the backslash before the forward slash was dropped (which you may or may not have intended).

    Right. This supposed to be ^\d+\/*\d*\t. Thanks for an advice.

  • Search Just Within Provided Line Number

    14
    1 Votes
    14 Posts
    428 Views
    Alan KilbornA

    @guy038 said in Search Just Within Provided Line Number:

    I don’t understand because, in my post, I do NOT speak about deleting the 2 digit, at any moment ?

    Ah…you’re right. I supposed I was confused because when you said:

    Leave the Replace with: zone Empty

    It appeared to me like this was setting up a replace-with-nothing aka delete operation!

  • Difference in display between Win11 Notepad and Notepad++

    3
    1 Votes
    3 Posts
    1k Views
    B

    @PeterJones Oh, so it’s actually a super simple issue. Thank you!

  • how to view the line separately where curly bracket are used

    8
    0 Votes
    8 Posts
    622 Views
    Mark OlsonM

    @PeterJones
    FWIW, if all you want is to pretty-print or compress the results of a regex search with PythonScript, you could replace the call to JsonTool’s pretty-print faculty with a quite simple script using Python’s json library.

    import json from Npp import editor PRETTY_PRINT_INDENT = 4 class CompressOrPrettyPrintRegexSearchResult: def __init__(self, compress): self.compress = compress def callback(self, m): parsed_group_2 = json.loads(m.group(2)) indent = None if self.compress else PRETTY_PRINT_INDENT formatted_group_2 = json.dumps(parsed_group_2, indent=indent) return m.group(1) + formatted_group_2 + m.group(3) if __name__ == '__main__': try: COPPRSR except NameError: COPPRSR = CompressOrPrettyPrintRegexSearchResult(True) editor.rereplace('(?s-i)(<fieldMap[^<>]*>)(.*?)(</fieldMap>)', lambda m: COPPRSR.callback(m)) # this will toggle between compressing and pretty-printing COPPRSR.compress = not COPPRSR.compress
  • How to Insert/Import Text from a Separate File

    2
    0 Votes
    2 Posts
    2k Views
    Alan KilbornA

    @AcmeNuclear said in How to Insert/Import Text from a Separate File:

    Does Notepad++ have an easier way to make this text file insertion into the current file - without executing something similar to Open (source file), Select all (source file); Copy; Select target location (receiving file); Paste; Close (source file)?

    Not really.
    But if you’re willing to use a scripting plugin, a simple script can be written:

    from Npp import * import os f = notepad.prompt('Enter file name:', '', '') if f and os.path.isfile(f): notepad.open(f) editor.selectAll() editor.copy() notepad.close() editor.paste()

    The script assumes you have the “MRU” setting selected (otherwise when the script closes the file tab it opens, you won’t be returned to the correct file tab):

    de7fbf65-50c8-42ec-bed9-ec4e218fe5ed-image.png

    And, yes, this script is very simple. It intentionally loads the file into Notepad++ (instead of just reading the file with Python) to avoid making non-Notepad++ assumptions about the encoding of the file, it expects you to know the name of the file you want (instead of a “picker”), it will close the to-be-inserted-file if that file happens to be open in N++ when the script is run, etc.). Many things could be done to make the script more well-rounded.

    For the basics of scripting, see HERE.

  • Add folding rules to an existing language

    3
    0 Votes
    3 Posts
    351 Views
    E

    @PeterJones oh… that seems not feasible, udl was a quite better option. Thank you for helping me make a quick decision.

  • Replace guid with guid from list randomly

    2
    0 Votes
    2 Posts
    482 Views
    Mark OlsonM

    The regex gurus on this forum might come up with some kind of crazy regex-based solution to this, but this is pretty easy to solve with PythonScript.

    # requires PythonScript: https://github.com/bruderstein/PythonScript/releases # ref: https://community.notepad-plus-plus.org/topic/25388/replace-guid-with-guid-from-list-randomly import random import re from Npp import editor, notepad, MESSAGEBOXFLAGS def main(): thing_to_replace = notepad.prompt('Enter the text you want to replace', 'enter text to replace', '') if not thing_to_replace: return is_regex = notepad.messageBox( 'Is the thing you want to replace a regular expression?', 'regular expression?', MESSAGEBOXFLAGS.YESNO) == MESSAGEBOXFLAGS.RESULTYES if not is_regex: thing_to_replace = '(?-s)' + re.escape(thing_to_replace) replacements = notepad.prompt( 'Enter a list of replacements (one per line)', 'list of replacements', '') if not replacements: return replacement_list = replacements.strip().splitlines() def get_random_from_list(_): return random.choice(replacement_list) editor.rereplace(thing_to_replace, get_random_from_list) if __name__ == '__main__': main()
  • save repeat operations in a script?

    19
    0 Votes
    19 Posts
    689 Views
    Furio SassiF

    @mkupper said in save repeat operations in a script?:

    @Furio-Sassi said in save repeat operations in a script?:

    Do you happen to know a text editor that supports scripts?

    Notepad++ has syntax highlighting for scripts but won’t offer help or hints as you are typing.

    There are editors known as IDE “integrated development environment” which allow you to single step through the script with the IDE also showing you what variables are being changed. It’s an area I’m not familiar with and particularly, an IDE that would let you trace or debug a Python script activated from Notepad++ and is doing Notepad++ and/or Scintilla specific things.

    Everything clear, thanks for the help! :)

    And I would also like to make peace with those I argued with, in the world there are so many reasons to argue that it would be stupid to argue even over something stupid like that. I came here in complete good faith, before writing I had also looked for information on macros (as I specified in my second post where I wrote “the macro, if I understand correctly, repeats the recorded operation”) but I had not found any references to scripts , that’s why I asked for help. Then the discussion took a direction I didn’t want.

    Thanks everyone, bye :)