• To align single line content to multiple lines

    2
    0 Votes
    2 Posts
    121 Views
    CoisesC

    @Lakshman-Prasath-Š said in To align single line content to multiple lines:

    Try this:

    From the main menu, choose Search | Replace….

    In the dialog, enter:
    Find what: Updated
    Replace with: Updated\r\n
    Wrap around checked
    Search mode: Extended
    then click Replace All.

  • Combine 2 searches

    6
    0 Votes
    6 Posts
    249 Views
    HaPe KrummenH

    @Mark-Olson @PeterJones

    thank you for your help. ChatGPT wrote me a routine that worked with a dozen files on my directory testfiles … now I copy all files to a directory to test it tonight with 25000 files

    I’m really surprised how easy this can be.

    And I’m reading the code to understand, what the script is doing as I apreciate any help but want to learn :-)

  • How to group lines with same beginning

    12
    0 Votes
    12 Posts
    947 Views
    Mark OlsonM

    @Alan-Kilborn said in How to group lines with same beginning:

    Python’s re uses a different engine than Notepad++ does. While this can be a “good thing”, sometimes it will trip a user up – they’ll get a “tricky” regular expression working in Notepad++, and then run into trouble when trying to automate using the same expression in a script.

    This does in fact happen in multiple places in my script. I’ll just break down how the regular expressions I used had to change to be compatible with Python’s re engine.

    STEP 1 REGEX CHANGES

    (?-s)^([^\$\r\n]*)(.*\R)(?:\1(.*)(?:\R|\z))*
    becomes
    (?m)^([^$\r\n]*)([^\r\n]*(?:\r?\n|\r))((?:\1(?:[^\r\n]*)(?:\r?\n|\r)?)*)

    (?-s) is unnecessary (because . already does not match newline by default in re) (?m) is necessary to make it so that ^ matches at the beginning of the file and at the beginning of lines. In Notepad++ regex, ^ matches the beginning of lines by default. Every instance of . must become [^\r\n] because in Python . matches \r, which is bad because that is the first character of the \r\n sequence that indicates a newline in Windows. Every instance of \R (shorthand for any newline) must become (?:\r?\n|\r), which matches the three most common newlines (\n, \r\n, and \r)

    The Step 2 regex also needs to be changed from (?-s)(\R?)(\x07)?([^\$]*)(\$+)(.*) to ((?:\r?\n|\r)?)(\x07)?([^$\r\n]*)(\$+)([^\r\n]*) because of point 3 above (the lack of \R in Python’s re)

    Finally, I had to create callback functions (the def replacer1(m): and def replacer2(m)) above, because the replacement regexes I used in Notepad++ don’t work in Python.

  • search / replace /delete parts of URL on several hundred pages

    9
    2 Votes
    9 Posts
    387 Views
    HaPe KrummenH

    Just wanted to say THANK YOU for your help!

    Beeing able to use regular expressions changes a lot and makes searching / replacing and deleting of texts so much easier.

    Have a good day!

  • Opening files in Macintosh and i need in windows

    4
    0 Votes
    4 Posts
    8k Views
    John RinconJ

    @Scott-Sumner . Thanks Scott.

    September 2024 and this message is still very helpful. I had the same problem loading a file that usually loads without problems.

    This time, the problem was the one related with your diagnosis. The line terminators CRLF in the end of line of the records.

    Thanks for help the community.

  • Run C++ without compiling

    7
    0 Votes
    7 Posts
    605 Views
    rdipardoR

    The directory will change automatically after clicking on NppExec’s “Follow $(CURRENT_DIRECTORY)” option (which I thought was enabled by default – sorry):

    Screenshot 2024-09-10 121533.png

  • How can I setup that when I close NotePad++ all tabs will close?

    3
    0 Votes
    3 Posts
    179 Views
    H4P3RH

    @PeterJones thank you very much!

  • How to integrate Notepad++ and Microsoft Edge?

    5
    0 Votes
    5 Posts
    1k Views
    mkupperM

    @Thomas-S said in How to integrate Notepad++ and Microsoft Edge?:

    The solution works also with EDGE, you only have to create this entry in the registry:

    This either does not work on Windows 11, no longer works, or maybe I need to reboot. As the registry path was for IE I also did the same for Edge.

    Attempts to view the source of a web page in Edge still create a new Edge tab with the URL set to something like view-source:https://community.notepad-plus-plus.org/topic/23872/how-to-integrate-notepad-and-microsoft-edge/4

    I added these, first as a test to see of plain old Notepad.exe was launched. I had also tried the full path to Notepad++. No joy.

    Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Edge\View Source Editor\Editor Name] @="Notepad.exe" [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\View Source Editor\Editor Name] @="Notepad.exe"

    Google for site:answers.microsoft.com "View Source Editor" finds most of the answers are for Windows 7. This forum post on answers.microsoft.com is more generic as far as the Windows version goes and is presumably is the source of the information in @Thomas-Spost.

  • How to update title of plugin

    5
    0 Votes
    5 Posts
    249 Views
    SinghRajenMS

    @rdipardo

    The - separator is indeed fixed.

    Yes, it is fixed as we can see it here. Also, it seems we need to ensure tbData.pszAddInfo remains valid. If you want to change anything there, update the text on the original pointer.

    I feel, instead passing _hself to LPARAM, it should pass tTbData to NPPM_DMMUPDATEDISPINFO.

    Anyway, - is very minor stuff here. I am good with it. Thanks for the help on this.
    Cheers!

  • replacing all in line with veried numbers1

    4
    0 Votes
    4 Posts
    160 Views
    CoisesC

    @darkfang1989 said in replacing all in line with veried numbers1:

    @Mark-Olson

    <csv xpath=“/entitygroups/entitygroup[@name=‘sleeperHordeStageGS332’]/text()” delim=“\n” op=“add” >
    zombieFatHawaiianElite, .24
    zombieFemaleFatElite, .24
    zombieHazmatElite, .39
    zombieLumberjackElite, .39
    zombieSoldierElite, .39
    zombieLabElite, .58
    zombieSpiderElite, .58

    this is one of the blocks, all blocks having different numbers. i would like to know if there’s a way to change the “zombieSpiderElite, .58” number in each block despite the number being different in each one.

    You can use regular expression replacement to do that. From the main menu, select Search | Replace…, then enter:

    Find what: (?<=zombieSpiderElite,)\s*[.\d]+
    Replace with: .00 (note: there is a space before the period, but you can’t see it here)
    Wrap around: checked
    Search Mode: Regular expression

    and click the Replace All button.

  • 0 Votes
    7 Posts
    1k Views
    rdipardoR

    @Sylvia Ngari

    You could also try a third-party theme, like this one, which even includes a module attribute style — although it’s debatable how useful that feature really is:

    Python (Coral Reef theme)

  • How to set options for the current file?

    4
    0 Votes
    4 Posts
    273 Views
    Alan KilbornA

    @Coises

    Actually, I think any of those ideas could be made to work well.

  • Changing foreground color of strings

    3
    1 Votes
    3 Posts
    157 Views
    Karl PerryK

    @PeterJones Thank you! I’m not a web developer, I’m a software product manager so didn’t know about the embedded JavaScript.

    All fixed now.

  • HTML File changes background color mid-file

    4
    1 Votes
    4 Posts
    309 Views
    rdipardoR

    @PeterJones said in HTML File changes background color mid-file:

    the embedded-Javascript’s template-literal problem could very well be a bug (or non-implemented feature) of the Scintilla project’s Lexilla library’s LexHTML

    It’s a known issue that also affects PHP:

    https://github.com/notepad-plus-plus/notepad-plus-plus/issues/15228 https://github.com/notepad-plus-plus/notepad-plus-plus/issues/15368 https://github.com/notepad-plus-plus/notepad-plus-plus/issues/13946#issuecomment-2127806280

    A single lexer module provides highlighting for (X/HT)ML and a few embedded scripts, including PHP, JavaScript, VB and Python. It is many years behind the current JavaScript standard; it was simply never programmed for interpolated strings between backticks (a JS feature since ca. 2015).

  • Finding the Nth Word in a File

    6
    0 Votes
    6 Posts
    336 Views
    guy038G

    Hello, @kristopher-gill, @alan-kilborn and all,

    Personally, I would use the following regexes, having the same concept of Nth word :

    The regex \A\W*(?:\w+\W+){N-1}\K\w+ finds/marks the Nth word, of any file containing, at least, N words

    The regex (\A|\R\h*\R)\W*(?:\w+\W+){N-1}\K\w+ finds/marks the Nth word, of any paragrah containing, at least, N words

    The regex (?-s)^[^\w\r\n]*(?:\w+[^\w\r\n]+){N-1}\K\w+ finds/marks the Nth word, of any line containing, at least, N words

    Notes :

    The Regular expression radio button is selected

    The Wrap around option is checked

    In case of a Find Next search, move to beginning of file, first ( Ctrl + Home )

    Use, either, the Find Next, the Find All in Current Document, the Find All in All Opened Documents or the Mark All button

    Best Regards,

    guy038

  • Eliminate excess verbiage from audio transcript

    4
    1 Votes
    4 Posts
    315 Views
    guy038G

    Hello, @mark-d-worthen-psyd, @mark-olson and All,

    @mark-d-worthen-psyd, I didn’t answer before, as we were travelling back home. Holidays time is over :-(

    Just for information, I found out a method which needs two regex S/R only !

    Let’s take again the @mark-olson’s INPUT text :

    Dr Worthen: blah1 blah2 Dr Worthen: blah3 blah4 Dr Worthen: blah5 Dr Worthen: blah6 blah7 blah8 John Doe: zjk1 John Doe: zjk2 zjk3 zjk4 zjk5 John Doe: zjk6 pouy1 zjk8 John Doe: pouy2 Bob Quzenheim: vbg Dr Worthen: nvbm Bob Quzenheim: jrrke Bob Quzenheim: bnbnm

    With this first S/R, we simply add a line-break after each block of lines, beginning with the same string before the colon

    SEARCH (?-s)^(.+:).+\R(\1.+\R)*

    REPLACE $0\r\n

    Giving this temporary text :

    Dr Worthen: blah1 blah2 Dr Worthen: blah3 blah4 Dr Worthen: blah5 Dr Worthen: blah6 blah7 blah8 John Doe: zjk1 John Doe: zjk2 zjk3 zjk4 zjk5 John Doe: zjk6 pouy1 zjk8 John Doe: pouy2 Bob Quzenheim: vbg Dr Worthen: nvbm Bob Quzenheim: jrrke Bob Quzenheim: bnbnm

    Then, with the second S/R :

    It removes the line-break and the next zone till a colon, if this line-break do not begin the current line

    It removes any pure empty line, as well

    SEARCH (?<=.)\R.+:|^\R    OR    (?<!^)\R.+:|^\R

    REPLACE Leave EMPTY

    And we get our expected OUTPUT text :

    Dr Worthen: blah1 blah2 blah3 blah4 blah5 blah6 blah7 blah8 John Doe: zjk1 zjk2 zjk3 zjk4 zjk5 zjk6 pouy1 zjk8 pouy2 Bob Quzenheim: vbg Dr Worthen: nvbm Bob Quzenheim: jrrke bnbnm

    Best Regards,

    guy038

  • Clearing Marked Lines

    4
    0 Votes
    4 Posts
    841 Views
    Drake McClearyD

    @PeterJones

    This is exactly what I was looking for - Sorry for the vague description!

    Thanks for the help.

  • Notepad++ VS VSCode

    8
    0 Votes
    8 Posts
    5k Views
    Mark OlsonM

    To expand on Notepad++ (NPP) vs. VSCode as a general text editor, I tend to prefer VSCode for “find/replace in files” operations (it is much faster), but NPP has a more feature-rich regex engine, so there are many kinds of find/replace operations that are a lot easier in NPP. The macro system and ability to mark search results are also big time savers in NPP.

  • Best Plugins

    3
    0 Votes
    3 Posts
    317 Views
    Juan FeJ

    @PeterJones said in Best Plugins:

    I don’t know of any plugins that do anything specific to improve the C++ experience.

    QuickText or one of the other snippets programs for doing snippets of code to speed up coding.

    EditorConfig if you like having some file types indented with tabs and others with spaces (for example, using spaces in most source files, but using tabs in your makefile).

    And NppExec is great for doing a “build-then-run” sequence, which I think would be quite useful for C++ (you can search the forum for my posts that include NppExec and gcc for an example of how to set up such a build system.

    As a word of advice: this forum will work better for you if you ask specific, meaningful questions about how to use Notepad++ for a specific task (no, “coding c++” is not a specific enough task); and this isn’t the right place to ask general coding questions (“how do I do XXXX in C++?” is off topic in this forum). Your first two questions in the forum have been way too open ended (and you are giving off AI/bot-generated vibes, which doesn’t bode well for you, since moderators can ban accounts that even seem to be spewing AI nonsense.)

    Thanks, im new in this forum

  • 0 Votes
    4 Posts
    212 Views
    Ag JA

    Understood, thank you!