• FIND is not returning any results

    12
    0 Votes
    12 Posts
    2k Views
    PeterJonesP

    @Robert-Harrison-0 said in FIND is not returning any results:

    Both Debug Info are identical as shown in a previous reply.

    Then you have some magic going on that I cannot reproduce, because Notepad++ does not treat files opened via Explorer Context Menu and files opened via File > Open any differently.

  • Replace numbers between quotes

    5
    0 Votes
    5 Posts
    1k Views
    guy038G

    Hello, @ivantiguy, @terry-R, @Coises and All,

    Here is the way I would choose to achieve your goal :

    From your present INPUT text : <Locations Seq="3396" DbRevision="670"> <Updates> <Location FRS_ID="30CD802CC0A744248253F1F869AADD8A" Frs_CompositeContract_Entity_Id="bdc85ad4-9e4d-e311-ba73-005056a60016" DisplayName="Canada"> <Updates> <ivnt_FullName> <First> - Canada</First> <Second>DbNull</Second> </ivnt_FullName> </Updates> </Location> </Updates> </Locations> <Locations Seq="3397" DbRevision="670"> <Updates> <Location FRS_ID="B33153FEF4014CC6BAC40581564BC5E9" Frs_CompositeContract_Entity_Id="9d7073c2-9e4d-e311-ba73-005056a60016" DisplayName="Central"> <Updates> <ivnt_FullName> <First> - Central</First> <Second>DbNull</Second> </ivnt_FullName> </Updates> </Location> </Updates> </Locations>

    With the following regex S/R :

    SEARCH \R(?!\h*<Locations)(?!\R)(?!\z)
    REPLACE ;

    We get the temporary text, below :

    <Locations Seq="3396" DbRevision="670">; <Updates>; <Location FRS_ID="30CD802CC0A744248253F1F869AADD8A" Frs_CompositeContract_Entity_Id="bdc85ad4-9e4d-e311-ba73-005056a60016" DisplayName="Canada">; <Updates>; <ivnt_FullName>; <First> - Canada</First>; <Second>DbNull</Second>; </ivnt_FullName>; </Updates>; </Location>; </Updates>;</Locations> <Locations Seq="3397" DbRevision="670">; <Updates>; <Location FRS_ID="B33153FEF4014CC6BAC40581564BC5E9" Frs_CompositeContract_Entity_Id="9d7073c2-9e4d-e311-ba73-005056a60016" DisplayName="Central">; <Updates>; <ivnt_FullName>; <First> - Central</First>; <Second>DbNull</Second>; </ivnt_FullName>; </Updates>; </Location>; </Updates>;</Locations>

    Do a column mode selection of all the Seq numbers :

    Open the Column Editor ( Alt + C )

    Select the Number to Insert option

    Initial Number 7400

    Increase by 1

    Repeat 1

    Leading None

    Format Dec

    Click on the OK button

    => The temporary text is changed as :

    <Locations Seq="7400" DbRevision="670">; <Updates>; <Location FRS_ID="30CD802CC0A744248253F1F869AADD8A" Frs_CompositeContract_Entity_Id="bdc85ad4-9e4d-e311-ba73-005056a60016" DisplayName="Canada">; <Updates>; <ivnt_FullName>; <First> - Canada</First>; <Second>DbNull</Second>; </ivnt_FullName>; </Updates>; </Location>; </Updates>;</Locations> <Locations Seq="7401" DbRevision="670">; <Updates>; <Location FRS_ID="B33153FEF4014CC6BAC40581564BC5E9" Frs_CompositeContract_Entity_Id="9d7073c2-9e4d-e311-ba73-005056a60016" DisplayName="Central">; <Updates>; <ivnt_FullName>; <First> - Central</First>; <Second>DbNull</Second>; </ivnt_FullName>; </Updates>; </Location>; </Updates>;</Locations>

    Finally, with this second and final regex S/R :

    SEARCH ;

    REPLACE \r\n    ( or \n for UNIX files )

    We get the expected OUTPUT text :

    <Locations Seq="7400" DbRevision="670"> <Updates> <Location FRS_ID="30CD802CC0A744248253F1F869AADD8A" Frs_CompositeContract_Entity_Id="bdc85ad4-9e4d-e311-ba73-005056a60016" DisplayName="Canada"> <Updates> <ivnt_FullName> <First> - Canada</First> <Second>DbNull</Second> </ivnt_FullName> </Updates> </Location> </Updates> </Locations> <Locations Seq="7401" DbRevision="670"> <Updates> <Location FRS_ID="B33153FEF4014CC6BAC40581564BC5E9" Frs_CompositeContract_Entity_Id="9d7073c2-9e4d-e311-ba73-005056a60016" DisplayName="Central"> <Updates> <ivnt_FullName> <First> - Central</First> <Second>DbNull</Second> </ivnt_FullName> </Updates> </Location> </Updates> </Locations>

    Best Regards,

    guy038

  • 0 Votes
    5 Posts
    804 Views
    RatheriusR

    @Alan-Kilborn I shall try it, thank you so much for your help! :)

  • Open file in Workspace by typing its name?

    20
    0 Votes
    20 Posts
    2k Views
    Mark OlsonM

    @Maxitrol-Mat
    My guess (completely unfounded, just based on my general sense of what that plugin does) would be that the freezes happen because the plugin does something that can potentially be very compute-intensive whenever a buffer is opened or closed, or when you switch to a different buffer. If that were the case, you would expect to see freezes whenever you change tabs or open/close a file.

    I would further speculate that the freezes might potentially have something to do with the opened file being in a directory that contains a lot of files and/or subdirectories. The way to test this would be to try opening a file in the root directory of a huge tree (e.g., Program Files, Documents) and see if that triggers a freeze, then compare to what happens when you open a file in a small directory tree.

  • 0 Votes
    3 Posts
    259 Views
    lightning speedL

    @Paul-Wormer
    It’s works perfectly. Many Thanks

  • Why is there so much white space waste at the bottom of my files?

    3
    0 Votes
    3 Posts
    280 Views
    Marc GrossmanM

    @Alan-Kilborn

    Thank you very much!!!
    That answered the mystery

  • Connecting with NotePad++ users for product feedback

    Locked
    2
    0 Votes
    2 Posts
    227 Views
    PeterJonesP

    @Gregor-Schilling,

    This Notepad++ Community forum is solely for discussing the free-and-open-source Notepad++ tool, and its various plugins and uses. This is not a forum for discussing some other tool that you want to create and convince people to buy.

    As this discussion is off-topic for the Community forum, this discussion is being locked.

  • Bringing back the old (pre-8.4.6) filetab right-click context menu

    6
    5 Votes
    6 Posts
    1k Views
    MapleM

    @MarioVolarevic said in Bringing back the old (pre-8.4.6) filetab right-click context menu:

    @Alan-Kilborn
    yay, thank you so much
    I just created a comment to add a note to the part of the instructions where you say “to put it where Notepad++.exe lives”, as it might not work for everyone.
    In my case I had to put it in folder :

    %appdata%\Notepad++
  • A little help with a regex (find & replace) ?

    9
    0 Votes
    9 Posts
    1k Views
    PeterJonesP

    @pickonedev said in A little help with a regex (find & replace) ?:

    I tried to find and learn by myself but it is far far far over me

    When you set out to learn the piano, you should start with “Row, Row, Row Your Boat” and “London Bridge”, and work your way up through Canon in D to Chopin and Liszt, over years of practice.

    The lesson: If you try to start with the more complicated, you will only end up discouraging yourself. Sometimes, with regex, it’s better to get a portion of it working, and then do the rest manually (so maybe try to search for something more generic that you can find, then use your own eyes to do the rest. Then, after more experimentation, you can figure out how to do more and more, until you can come up with pretty powerful regex.

    I want to add “sensor.variable_” to the lines which starts with "entity_id: " (even if there are spaces in front of it) but not contain the dot character " . "

    Okay, this isn’t a full concerto, but it is an intermediate etude.

    Break it into smaller chunks for developing:

    line starts with entity_id: even if there are spaces => ^(\h*entity_id:) ^ = line starts with \h* = 0 or more spaces entity_id: = literal text (...) = we want to save this chunk for later; it will be group#1 and referenced later as $1 but the rest of the line does not contain the dot character => ([^.\r\n]+)$ (...) = save the rest of the line as group#2 (later called $2) [^...] = make a “negative” character class, to define a list of characters that you don’t want to match [^.\r\n] = don’t want to match a literal period, or the CR or LF newline characters + = match 1 or more of the thing that came before – so in this case, “match 1 or more characters that are not period or newline characters” $ = match the end of the line thus, the only thing allowed for this portion of the search are characters that are not period or newline, and that extends all the way to the end of the line. It will thus match if the line doesn’t have a dot, and won’t match if it does. Put it together: you want the first group, followed by a space, followed by the second group: ^(\h*entity_id:) ([^.\r\n]+)$ Replacement: you want to replace it with the first group, then a space, then the new text, then the second group: $1 sensor.variable_$2

    ----

    Useful References Notepad++ Online User Manual: Searching/Regex FAQ: Where to find other regular expressions (regex) documentation

    ----

    Please note: This Community Forum is not a data transformation service; you should not expect to be able to always say “I have data like X and want it to look like Y” and have us do all the work for you. If you are new to the Forum, and new to regular expressions, we will often give help on the first one or two data-transformation questions, especially if they are well-asked and you show a willingness to learn; and we will point you to the documentation where you can learn how to do the data transformations for yourself in the future. But if you repeatedly ask us to do your work for you, you will find that the patience of usually-helpful Community members wears thin. The best way to learn regular expressions is by experimenting with them yourself, and getting a feel for how they work; having us spoon-feed you the answers without you putting in the effort doesn’t help you in the long term and is uninteresting and annoying for us.

  • How To Keep Text Highlighting After closing the document?

    18
    0 Votes
    18 Posts
    8k Views
    Pika714444P

    @Alan-Kilborn

    I hope they do it ASAP because it will be a very beneficial feature for highlighting a specific important words/sentences/line in a large text output file , this is the feature i needed actually from the purpose of this post.

  • Find results not visible when 3th screen is off

    2
    1 Votes
    2 Posts
    581 Views
    Alan KilbornA

    @Arne-Everhard said in Find results not visible when 3th screen is off:

    Is this a bug or something to live with.

    Probably considered a bug; you can file a bug report by following instructions HERE if you’d like.

    Workaround:

    Immediately after running a search that should show you the Search results window but doesn’t, press Alt+spacebar, then press m. What this does for me (on Win11, and hopefully for you as well) is put a “ghost” rectangle on the monitor which currently has the mouse cursor on it. You can then move the ghost rectangle to where you want it (by simply moving the mouse – the ghost will follow), and finally left-click to have the real window appear.

    Side note: THIS thread has further info about making non-seeable windows seeable again.

  • Suggestions

    2
    0 Votes
    2 Posts
    255 Views
    Mark OlsonM

    @Robert-Phillips
    I recommend you look at the issues, check if someone’s already submitted an issue like yours, and submit an issue if not.

  • macro carriage return = &#x000D;&#x000A; with update v.8.5.3

    11
    0 Votes
    11 Posts
    4k Views
    PeterJonesP
    Good News

    I have confirmed this morning that the following macro will work with v8.5.2, v8.5.3, and v8.5.4, embedding the CRLF newline in each:

    <Macro name="Newline 2digit" Ctrl="no" Alt="no" Shift="no" Key="0"> <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0D;" /> <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0A;" /> </Macro>

    So the two-hex-digit entities work, but the four-hex-digit ones do not. I will shortly be updating the FAQ to match.

  • 0 Votes
    4 Posts
    908 Views
    Mark OlsonM

    Yep, AlanKilborn is right, I misunderstood your question.

    Assuming you’re trying to use a find/replace to convert the first example to the second example, I recommend

    FIND: (?s-i)(?:^for\R|(?!\A)\G)(?:(?!\Rnext$).)*?\K^
    REPLACE WITH \x20\x20

  • Ersetzen durch Absatzmarke

    2
    0 Votes
    2 Posts
    475 Views
    Alan KilbornA

    @Thomas-Rammler said in Ersetzen durch Absatzmarke:

    I can’t find how to replace characters with a paragraph mark (creating a new paragraph).
    Does anyone know a way to get there or could it be implemented?

    What’s a “paragraph mark”? Do you mean you have a pilcrow character embedded in your text file?

    If so, select just that character and press Ctrl+h. It should appear in the Find what box. Change to the Replace with box and enter \r\n\r\n. Change the Search mode to be Regular expression.

    This should get you what you want or close to it, as near as I can tell from your description.

  • Can anyone confirm this issue with EditorConfig?

    3
    0 Votes
    3 Posts
    331 Views
    timintT

    @mpheath Wohoo!! That was it, thank you a lot! I really needed a pair of fresh eyes. 👍👍

  • Foreign characters (Cyrillic) issue

    5
    0 Votes
    5 Posts
    454 Views
    gerdb42G

    And also paste the “Debug Info” as this might be a plugin issue.

  • .LOG updates

    4
    2 Votes
    4 Posts
    4k Views
    PeterJonesP

    After I and @rdipardo had both separately confirmed that MS notepad.exe really does have that feature, I decided it was worth the effort to write the script, even if the original poster never comes back to ask for it.

    Installation instructions

    see full instructions in our FAQ
    https://community.notepad-plus-plus.org/topic/23039/faq-desk-how-to-install-and-run-a-script-in-pythonscript save the script below as DotLogTimestamp.py in the PythonScript user-scripts directory (usually %AppData%\Notepad++\Plugins\Config\PythonScript\Scripts\) if you want this feature active every time you run Notepad++: Plugins > Python Script > Configuration: set Initialisation to ATSTARTUP As the FAQ mentions, add the following lines to the user startup.py import DotLogTimestamp _DLTS = DotLogTimestamp.DLTS() script: DotLogTimestamp.py # encoding=utf-8 """in response to https://community.notepad-plus-plus.org/topic/24650/ - Call this from startup.py using import DotLogTimestamp _DLTS = DotLogTimestamp.DLTS() - Make sure to set Plugins > PythonScript > Configuration > Initialisation to "ATSTARTUP" instead of "LAZY" - installation instructions: see https://community.notepad-plus-plus.org/topic/23039/faq-desk-how-to-install-and-run-a-script-in-pythonscript """ from Npp import editor,notepad,console,NOTIFICATION from datetime import datetime class DLTS(object): def __init__(self): console.write("Registered DotLogTimestamp.py callbacks\n") notepad.callback(self.fileopened_callback, [NOTIFICATION.FILEOPENED]) notepad.callback(self.bufferactivated_callback, [NOTIFICATION.BUFFERACTIVATED]) self.active = True self.bufferIDs = [] def toggle(self): self.active = not self.active console.write("DotLogTimestamp.py callbacks are {}\n".format('active' if self.active else 'inactive')) def fileopened_callback(self, args): if self.active: self.bufferIDs.append(args['bufferID']) def bufferactivated_callback(self, args): if self.active: if args['bufferID'] in self.bufferIDs: line = editor.getLine(0).strip() if line[0:4] == ".LOG": editor.appendText("{}\n".format(datetime.now().strftime("%Y-%b-%d %H:%M:%S"))) self.bufferIDs.remove(args['bufferID']) if __name__ == '__main__': try: _DLTS.toggle() except NameError: _DLTS = DLTS()
  • V. 8.5.4 (64 bits) still crashing when opening a TXT file.

    2
    0 Votes
    2 Posts
    707 Views
    PeterJonesP

    @PaulStSmith ,

    Opening Notepad++ by the shortcut or Start Menu, everything works fine.

    You most likely have two copies of Notepad++ installed; your file association is pointing to one which is crashing (maybe because of an incompatible plugin installed; follow this FAQ’s debug procedure); and the other (which you get to by your shortcut or start menu) points somewhere else.

    Right click on the shortcut or the start menu entry, look at the shortcut Properties, and look at the shortcut’s Target path.

    Then run regedit.exe and search for notepad++.exe – you will most likely find that one or more of the mentions in the registry point somewhere different than your shortcuts do.

  • General help to built N++ macros in file "shortcuts.xml"

    3
    7 Votes
    3 Posts
    448 Views
    guy038G

    Hi, All,

    So, I tried to follow the right way with script plugins and did some tests with, either, the NppExec, Python Script and LuaScript plugins.

    However, I could not get the Line Number margin to toogle from visible to invisible status and vice-versa !

    For instance :

    On NppExec console ( v0.84 ), the two commands :

    npp_sendmsg WM_COMMAND IDM_VIEW_LINENUMBER

    npp_sendmsg WM_COMMAND 44012

    do not work

    On Python console ( v2.0.0.0 - Python 2.7.18 ), the two commands :

    notepad.menuCommand(MENUCOMMAND.VIEW_LINENUMBER)

    notepad.menuCommand(44012)

    do not work, as well

    On LuaScript console ( v0.12 - Lua 5.3 ), the two commands :

    npp:MenuCommand(IDM_VIEW_LINENUMBER)

    npp:MenuCommand(44012)

    do not work, also

    Apparently, adding the options Constant and Dynamic width, regarding the Line Number margin, in N++ v7.9.2, breaks down this functionality, since that version :-((

    I should have realised that before ! If it was impossible to get this fucntionality with a N++ macro, this necessarily meant that NO script plugin could do any better !

    To be sure that I correctly used the scripts syntax, I did some tests with two other functions, which worked perfectly :

    On NppExec console :

    npp_sendmsg WM_COMMAND IDM_VIEW_REDUCETABBAR or npp_sendmsg WM_COMMAND 44005 reduce/enlarge the tabs

    npp_sendmsg WM_COMMAND IDM_FILE_NEW or npp_sendmsg WM_COMMAND 41001 open a new file

    On Python console :

    notepad.menuCommand(MENUCOMMAND.VIEW_REDUCETABBAR) or notepad.menuCommand(44005) reduce/enlarge the tabs

    notepad.menuCommand(MENUCOMMAND.FILE_NEW) or notepad.menuCommand(41001) open a new file

    On Lua console :

    npp:MenuCommand(IDM_VIEW_REDUCETABBAR) or npp:MenuCommand(44005) reduce/enlarge the tabs

    npp:MenuCommand(IDM_FILE_NEW) or npp:MenuCommand(41001) open a new file

    So, how to be able to show / hide, easily, the Line Number margin ?

    May be, I need the @astrosofista’s skills as he could provide us with an AutoHotKey script to achieve this goal ?

    Best Regards,

    guy038