• changing the font

    4
    0 Votes
    4 Posts
    262 Views
    PeterJonesP

    @Snabel42 ,

    I have never seen a reason for the current order – and I just searched the historical repo issues to see if it was ever explained, and couldn’t find a mention of a reason.

    But global overrides have come up often enough recently that I finally took the time to put in a feature request to ask that Default Style be moved before Global override.

  • Help with a couple of Macros

    4
    1 Votes
    4 Posts
    202 Views
    Terry RT

    @Darkwood-Consulting said in Help with a couple of Macros:

    Move to the end of the next non-blank line

    I’ve come up with a revised version as the previous one looks like it failed when there weren’t any more “non-blank” lines in the file. So now the regex is:
    (?-s)(.+)?(\R+)?(.+)?\K

    So this is used in the Find function. Copy the red text above (the actual regex) and paste into the “Find What” field of the Find function. Have one of your files open and do a few tests by putting the cursor in various locations and clicking on “Find Next”. You need to test all possible scenarios you might encounter to be sure this will meet your needs.

    So once a regex has been found to work, next comes the step of recording the macro. Whilst I’m aware you already have some knowledge of how to record a macro, I’m not sure if you’ve got past the basics of recording a shortcut key combo. To record this macro, you would start the recording as you normally do, then either use the mouse to click on the “Search” menu item, then “Find” or use the appropriate shortcut key for “Find” of which the default is “Ctrl F”. You will see this alongside the menu option. If you have already done some tests a working regex will already be available. Just make sure it is listed in the Find What field. Click on “Find Next” and then click on close. At this point you can stop recording the macro, save and name it.

    To give a bit of background to the regex:
    (?-s) - DOT characters do not include carriage return/line feeds
    (.+)? - consume as many characters as possible on the current line, ? allows for an empty line
    (\R+)? - consume as many carriage return/line feeds as possible from the current position (which is the end of a line), ? allows for a non-empty line. After this the cursor will be at the start of non-empty line or end of file
    (.+)? - consume as many characters as possible on the current line, ? allows for an empty line/end of file position
    \K - forget everything selected and leave the cursor in the new position

    Terry

    PS, although you refer to a blank line, are you sure it is truly empty, not just containing some blank characters as that changes the solution. Good luck.

  • How to enlarge toolbar icons.

    2
    0 Votes
    2 Posts
    220 Views
    PeterJonesP

    @Giacomo-Margarito ,

    Pick one of the “large” choices in Settings > Preferences > General > Toolbar

  • Enlarging font size??

    5
    0 Votes
    5 Posts
    934 Views
    Chad JbC

    @Chad-Jb Thanks everyone. That really helps. I’m not blind but I do have low vision. This seems much better than the old Windows Note Pad.

  • Option to always show arrow on scrollbars

    6
    0 Votes
    6 Posts
    226 Views
    Eric CoutierE

    @gerdb42
    Thanks for your answer. Sadly, it’s that I’ve seen searching on the Internet. But I fear there’s no solution:

    But I have found a workaround by applying a theme (on askvg - I cannot post link for the moment)

    01ae5ef2-4397-4786-9879-776f72df933f-image.png

  • Help how to find duplicate sentence

    2
    0 Votes
    2 Posts
    164 Views
    PeterJonesP

    @NASSER-AL-NAAMANI ,

    You are way too vague for us to give a complete answer. You say “sentence”, but then use an example of the single word abcde repeated. Since we have no idea what characters are allowed in a sentence for your data, we would have to make our answer super-generic. And because we don’t know whether they are always separated by just one character (like your example comma), or if it could have dozens of other “sentences” between, then we’d have to make it allow a generic amount of characters between. The problem with super-generic regex that allow lots of variation in the number of characters between is that it’s an exceedingly inefficient regex, and if there are too many characters in your file, the regex engine can decide it’s out of memory/resources for it’s capture-and-backtrack algorithm, and stop before finding matches.

    If each of your “sentences” were a separate line of text, it would be much easier – and in fact, Notepad++ already has “Remove duplicate lines” or “Remove consecutive duplicate lines” built into the Search > Line Operations menu.

    There’s also the matter of “filter out” – there are two ways to think of it: if there are two matching “sentences”, then “filter out” (delete) the second; or if there are two matching “sentences”, then “filter out” (delete) the first. Both of those variants involve difficulties of their own.

    In general, the regex solution will involve the concepts of capture groups and backreferenes, and either a lookahead assertion or (because true lookbehinds cannot be variable width) using the \K control flow to mimic a variable-width lookbehind.

    To do the delete-the-first, you would use a lookahead. So it would end up being something like

    FIND = (.*)(?=.*?\1)
    REPLACE = <leave empty>
    SEARCH MODE = Regular Expression the (.*) is the capture group, capturing just about anything of any length the (?=...) is the lookahead, which means the characters have to match, but the replacement will not affect anything in that lookahead the .*? inside the lookahead means “match anything in between” the \1 inside the lookahead means "match exactly the same text as was already matched in capture group 1

    To do the delete-the-second, you would want a lookbehind; but since the number of characters could be any length, you have to use \K to “reset” instead:

    FIND = (.*).*?\K\1
    REPLACE = <leave empty>
    SEARCH MODE = Regular Expression Must use REPLACE ALL; cannot do a whole bunch of single REPLACE, because using \K you might have to run it multiple times, because it may have advanced beyond the “first” of some matching pair when it did the previous. the \K says “anything before the \K must match, but only stuff after the \K will be replaced by the REPLACE WITH text” the other concepts are the same

    However, neither of those will actually work for you, because if your file was just the word tenet, either logic would see that the t is in your document twice, and delete one of them; then would see that e was in the document twice, and delete one of those, too. So with the delete-the-first solution, you’d end up with net; if you used the delete-the-second solution, the first time you REPLACE ALL, it would delete the t at the end, to produce tene, and then running it a second time, it would delete the e at the end, to produce ten . Even worse, the document tenet is a funny word, but it is a word. would end up with ten isafuyword,b. using the delete-the-second, and efny,butisa word. using the first.

    If that’s not the weird results you want, then you’d have to make some sort of real regex definition for a “sentence”. And that’s more difficult that you might think. And I am quite certain, for any definition or regex that you think you had which would reliably match a sentence, I could come up with an exception that your definition/regex doesn’t cover. But if by some miracle, you could come up with a definition for a sentence or phrase that works for you in all edge cases, you would put it inside the first parentheses in one of the two regex I showed above.

    To give more examples of why you are likely to not find what you want:

    Using the definition of “a ‘sentence or phrase’` is any whole word (set of word characters between word boundaries) followed by anything else”, then

    delete-the-first: FIND = (\b\w+\b.*)(?=.*?\1) , which would transform tenet is a funny word, but it is a word. into tenet funny , but it is a word. delete-the-second: FIND = (\b\w+\b.*).*?\K\1, which would result in tenet is a funny word, but it .

    Using the definition of "a ‘sentence or phrase’` is two or more whole words (set of word characters between word boundaries) separated by only spaces:

    delete-the-first: FIND = (\b\w+\b.*)(?=.*?\1) , which would transform tenet is a funny word, but it is a word. into tenet funny word, but it is a word. delete-the-second: FIND = (\b\w+\b(?:\h+\b\w+\b)+).*?\K\1, which would result in tenet is a funny word, but it word. this deleted just the phrase is a , which meets your generic phrasing of “sentence or phrase”.

    I’m not sure anything much more complicated would truly get better, and I am sure you’d run across weird exceptions the more complicated you got.

  • Need help in replace and delete all similar sentence

    4
    0 Votes
    4 Posts
    208 Views
    guy038G

    Hello @tommy-tan, @lycan-thrope, @mark-olson and All,

    Given the INPUT text, below

    SM1+VRDP4-OOCU4868933:20240906151200:;;::KOJ’ SM1+VRDP4 OOCU7704147:20240905132700:;;::KOJ’ SM1+VRDP4-CBHU4477056:20240906141100:;;::KOJ’ DEF456SM1+VRDP4-CBHU4477056:20240906141100:;;::KOJ’ AB9+VRDP4-CBHU4477056:20240906141100:;;::KOJ’

    A more simple formulation would be to use one of the three regexes, below :

    (?-is)VRDP4.+?(?=:) which matches any string beginning by an uppercase string VRDP4 till the very first colon of the current line

    (?-is)(?<=^SM1\+)VRDP4.+?(?=:) if, in addition, the uppercase string VRDP4 is preceded by an uppercase string SM1+, strictely beginning a line

    (?-is)(?<=SM1\+)VRDP4.+?(?=:) if, in addition, the uppercase string VRDP4 is just preceded by an uppercase string SM1+

    Now , if we consider the general example below :

    ABC XYZ 123ABC XYZ ABCXYZ 123ABCXYZ

    As said above :

    The regex (?-i)(?<=^ABC)XYZ would find any uppercase string XYZ if predeced by an uppercase string ABC strictely beginning a line

    The regex (?-i)(?<=ABC)XYZ would find any uppercase string XYZ, if preceded by an uppercase string ABC

    However the two regexes (?-i)^(?<=ABC)XYZ or (?-i)(?<=ABC)^XYZ cannot find any match ! Why ? Just because the ^ is a regex assertion which is a shorthand of the (?<=\n|\r) syntax. Thus, these two syntaxes can be replaced by (?-i)(?<=\n|\r)(?<=ABC)XYZ and (?-i)(?<=ABC)(?<=\n|\r)XYZ. And it obvious that the string XYZ CANNOT be preceded, at the same time, with both an EOL character and the string ABC !

    For people who want to know the right syntaxes, in this specific case, they are (?s-i)^(?<=ABC..)XYZ and (?s-i)(?<=ABC..)^XYZ, where the two dots represent an EOL char ! So, they both match an uppercase string XYZ, right after an uppercase string ABC\r\n

    Note that the third syntax (?s-i)(?<=ABC..)XYZ, without any ^ symbol, matches also the two uppercase strings XYZ, beginning a line

    Actually, to be exhaustive, the later regex (?s-i)(?<=ABC..)XYZ matches any uppercase string XYZ, preceded by a fixed string of 5 characters :

    The first three are the uppercase string ABC

    The following two chars can be absolutely any char ( standard or EOL characters )

    Best Regards,

    guy038

  • 1 Votes
    29 Posts
    2k Views
    PeterJonesP

    @Manfred-Drechsel said in Highlighting with self created words in "langs.xml" does not work:

    Only a minor issue which I’ve seen is the width of the style selection list control. It should be wider to see the full text of the styles. See attachment. Guess I directly should file an issue for NPP?

    It’s always been that way (see for example, the “INSTRUCTION WORD” on ActionScript, or the “Indent guideline style” in Global Styles, both of which have gone beyond the width for multiple versions of N++).

    If you want that aspect of the GUI changed, you would need to put in a feature request in N++'s GitHub repo. I would suggest asking for either resizable, or wider-by-default, or at least having a hover (or having a hover plus resizable/wider).

    I am highly doubtful that the Developer would implement be wider-by-default; there’s slightly more chance that he’d make it user-resizable; I would say the best-chance for implementation is using the full Style name as the hover text for each entry, which is why I suggested it, but no guarantees it would be implemented.

  • How to play Audio MP3 files saved on laptop in notepad plus plus

    6
    0 Votes
    6 Posts
    736 Views
    Lycan ThropeL

    @guy038 said in How to play Audio MP3 files saved on laptop in notepad plus plus:

    file:///D:\MyMusic\Rolling%20Stones\YouCantAlwaysGetWhatYouWant.mp3

    Guess I learn something everyday. I never double click links…so never thought that NPP did that launch. Oh well, I stand corrected. :-)

  • Search accent-insensitive

    5
    0 Votes
    5 Posts
    664 Views
    PeterJonesP

    @VERSEAU44 said in Search accent-insensitive:

    Why have I this result (white rectangles) when I copy/paste tables in my NotePad++ ?

    Because your font (Notepad++ menu Settings > Style Configurator > Language: Global Styles > Style: Default Style > Font name) doesn’t include glyphs for those characters. You might be able to toggle Settings > Preferences > MISC > ☐ Use Direct Write and restart Notepad++, and it might help the OS grab glyphs from other fonts to use in Notepad++ when your active font doesn’t have a specific glyph.

  • INI files opening in wrong language (Temporary fix found)

    2
    0 Votes
    2 Posts
    256 Views
    PeterJonesP

    @Red-Green ,

    when I take a portable v8.6.9 (which just has the default extensions from langs.xml, with no changes in the Style Configurator user-ext) and open an ini file, it appropriately identifies it as an INI.

    0ea277b6-4e19-4f07-bb1f-576d151e3dc7-image.png

    Can you use the </> button in your reply and paste in a short .ini file which consistently is mis-identified, so we can try to reproduce the problem? Because right now, “it works for me”.

  • Is Visual Basic dependent on .NET?

    3
    0 Votes
    3 Posts
    279 Views
    Ann OnymousA

    @PeterJones I only asked since I saw it as an option in Language and I’d rather use N++ than VSC. Sorry for the confusion.

  • Facebook login broken

    2
  • Style token not saved

    30
    0 Votes
    30 Posts
    11k Views
    SalepS

    @PeterJones thank u sir I got it

  • Notepad ++ connecting to browsers from program

    3
    0 Votes
    3 Posts
    167 Views
    Mark OlsonM

    You could also right-click on the tab for a file and select Open in Default Viewer from the drop-down menu that appears. If, for example, your default viewer for a .html document was Firefox, that would open that file in Firefox.

    I have no idea which NPP version that option was first introduced in.

  • alphabetic order

    4
    1 Votes
    4 Posts
    214 Views
    pouemes 0P

    thanks Alan and Coises will see the plugin

  • A simple search and replace

    8
    0 Votes
    8 Posts
    250 Views
    Mark OlsonM

    @guy038 said in A simple search and replace:

    To my mind, all these statements can be solved with the two following regexes :

    Regex A : (?-s)"(?:\\.|.)+" Regex B : (?-s)"(?:\\.|.)+?"

    I would use Regex B with a slight modification; the +? should be a *? to correctly handle the empty string "".

    Thus, I think the simplest regex we can use for this task is probably (?-s)"(?:\\.|.)*?"

    There is one important caveat here: these regexes for recognizing JSON strings will break if you start the search in the middle of a string.

    For example, if you have this text

    "foo" "bar" "from\r\n\t[\"\\\"here\\\"\", \"to\", \"here\" is all one string]"

    the best regex, (?-s)"(?:\\.|.)*?", will correctly identify exactly three strings in the file if you start the search at the beginning of the file.

    But if you start with the caret after the word from on the second line, you will incorrectly identify "\\\"here\\\"\", \"to\", \"here\" is all one string]" as being a valid string.

  • Hotkey for Search Results > Copy Selected Line

    3
    1 Votes
    3 Posts
    175 Views
    Artur HarisonA

    @PeterJones
    I thought it would be in the release.
    Since the status on GitHub is implemented.
    Sorry!

  • How to (auto) format text to start at column 25, 85 and 115

    10
    0 Votes
    10 Posts
    792 Views
    Alan KilbornA

    Another editing technique that might help; say you have this:

    218c1177-23de-4b20-b9a1-2db2b1d6c785-image.png

    Clearly all of the data in the second column needs to be lined up.

    If you create a column caret using Shift+Alt+arrows and make it look like this:

    93212e91-ccf9-4b6f-8a93-0d3cbaf7aaf7-image.png

    and then press Ctrl+Delete, you’ll get something looking like this:

    3f7b30e7-d6e8-427b-9c70-bb66c644d59a-image.png

    It’s then a simple matter to press space-bar a few times to get all of the data aligned, and in the correct column:

    289e96d7-55b3-4b4a-a488-285d26cd325a-image.png

    Note that in the create-column-caret step, the column caret does NOT touch any of the text to be aligned, there is one or more intervening space(s) (this is a very important point).

  • Notepad data deleted after clicking "Yes" to prompt

    5
    0 Votes
    5 Posts
    302 Views
    Alan KilbornA

    @githubtools101 said:

    there is a way to TURN OFF that unnecessary prompt for the future:
    Under “File Status Auto-Detection” click Disable from the drop-down menu
    Now, you will NEVER be given this prompt again!
    I don’t understand why Notepad++ has this feature to begin with

    So @githubtools101 had a problem with data loss, and your solution is to give him a method that can guarantee future data loss? Nice job…