• Enlarging font size??

    5
    0 Votes
    5 Posts
    1k 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
    266 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
    178 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
    234 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
    798 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
    676 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
    268 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
    307 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
    184 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
    228 Views
    pouemes 0P

    thanks Alan and Coises will see the plugin

  • A simple search and replace

    8
    0 Votes
    8 Posts
    258 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
    201 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
    951 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
    395 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…

  • To align single line content to multiple lines

    2
    0 Votes
    2 Posts
    137 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
    287 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
    1k 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.