• how to bulk "keep" only last 10 lines of code in 122 tabs

    8
    1 Votes
    8 Posts
    505 Views
    PeterJonesP

    @guy038 ,

    ^.*\Z

    I knew that a single ^.*\Z could match zero characters; I intended it that way in case the last line of the file was an empty line (ie, a file that has a final newline). And that explains why one of the alternate versions that I played with but didn’t publish was off-by-one when I had that (though I didn’t put the two together at the time).

    But I was suprised that ten instances of \Z (from (^.*\Z){10}) could match the single end of the file. I know it’s a “zero width” match, but I hadn’t thought about the fact that being “zero width” meant that two or more could match in a row. But yes, I justed tested, and confirmed that you can have a regex with multiple EOF in a row and have it still match… or multiple ^ or $ as well. Interestingly. \Z{10} is invalid, but (\Z){10} is allowed – so you cannot multiple a true zero-width expression (which makes sense), but if you have a group that happens to contain only a zero-width expression, you can multiply that expression.

    Thanks for helping me learn something new today. :-)

    (?-s)^.*\R(?=(?:^.*\R|.+\Z){10})

    I was trying to avoid repeating myself with having to put the dots in both alternations. (?-s)^.*\R(?=(?:^.*(?:\R|.\Z)){10}) works just as well… but yours actually requires less typing, so my adherence to DRY made mine longer. :-)

  • Extended ASCII ALT+xxx char Display issue

    9
    0 Votes
    9 Posts
    3k Views
    PeterJonesP

    @David-Tcheki wrote,

    OEM-850

    BTW: OEM-850 / CP850 was the default codepage in Western Europe. US Computers default to CP437 (OEM-US), so their table of ALT+### is a bit different:

    a4eebea5-5263-452d-b9b6-9d9424215403-image.png

    As the Wiki: Alt Codes page points out,

    The familiar Alt+number combinations produced codes from the OEM code page (for example, CP437 in the United States)[c], matching the results from MS-DOS. But prefixing a leading zero (0) to the number (usually meaning 4 digits) produced the character specified by the newer Windows code page, allowing them to be typed as well.

    So future readers on a US machine would want to use this table as their map, not the CP850 table shown previously.

  • Recent file

    2
    0 Votes
    2 Posts
    156 Views
    PeterJonesP

    @Donald-Milotte ,

    In my recent file list I have files in there I haven’t opened for a long time! One from 2019!

    Congratulations, I guess?

    File > Empty Recent File List will clear that whole list, if you don’t want it there any more.

    Or Settings > Preferences > Recent Files History allows you to set a maximum number of entries. So if File2019 is in the 15th slot, you could change your max list to 10, and the next time you enter Notepad++, it will only have 10 entries, so the ones older than TenthFile will no longer be listed.

  • Removing unwanted text in multiple lines

    2
    0 Votes
    2 Posts
    159 Views
    astrosofistaA

    @Brentley-Hefner

    Yes, I think so. Try the following regex:

    Search: (?-s)^\w+ ([^ ]+).* Replace: $1

    Put the caret at the very beginning of the document, select the Regular Expression mode and click on Replace All.

    Hope this helps.

  • Regex Help Wanted - Delete all lines containing "STRING"

    7
    0 Votes
    7 Posts
    879 Views
    Gary SmithG

    @PeterJones said in Regex Help Wanted - Delete all lines containing "STRING":

    (?-is)^.?System Tag.(\R|\z)

    Worked flawlessly , thanks a lot folks for all your help, just saves me a whole bunch of work :)

  • Distorted display of the Notepad ++ window

    2
    0 Votes
    2 Posts
    524 Views
    PeterJonesP

    @Alex-Hoesli ,

    This is a known issue (https://github.com/notepad-plus-plus/notepad-plus-plus/issues/9717) mentioned multiple times in the forum.

    Some people have had luck by rebooting, or changing to administrative mode, or updating video drivers.

  • Search exact

    2
    0 Votes
    2 Posts
    159 Views
    EkopalypseE

    @Alex-Danko said in Search exact:

    Hi everyone,
    i want to search for a G0 which is followed only by a letter and not by a number.
    Example:
    G0X5.Y105.
    G01Z0.2
    G01X5.Y-5.
    G0Z5.
    Search result should be only those lines:
    G0X5.Y105.
    G0Z5.
    Is it possible?
    Thanks in advance.

    Something like this: G0[A-Za-z] with a regular expression search should accomplish what you want.

  • Function list not working

    6
    1 Votes
    6 Posts
    2k Views
    p rP

    Thank you very much.
    Wonderfull.
    Yes, of course, the <parsers>…</parsers> was the problem… holy shit
    Nice weekend
    Greetings
    Peter Ritzmann

  • Help to replace signs

    10
    0 Votes
    10 Posts
    551 Views
    serg othS

    @Alan-Kilborn Thanks a lot. Everything is clear

  • Create a User Defined Language from existing

    6
    1 Votes
    6 Posts
    11k Views
    PeterJonesP

    @Yoan-Soucy ,

    Sorry. The UDL and the Lexers are two separate bits of code, so you cannot just “inherit” or “export” the original lexer to a UDL.

    However, you can add extra highlighting to any builtin lexer (like the HTML or XML or SQL lexer) or to a User Defined Language (UDL) using regexes via the script EnhanceAnyLexer.py that @Ekopalypse shares in his github repo … this might allow you to provide the extra syntax that either the lexer alone or the UDL alone won’t give you.

  • ftp dir problesms

    1
    0 Votes
    1 Posts
    132 Views
    No one has replied
  • 8.1.3 not displaying keystrokes in real time

    3
    0 Votes
    3 Posts
    266 Views
    Ajay PrasharA

    @cfroehle Thank you for the solution to a problem that has made Notepad++ unusable for me. The delay caused by the autocomplete feature has been an intermittent pain for YEARS. I am guessing that this feature gets reenabled upon some action such as an update but I am not sure.

    Thanks again.
    -Ajay

  • Remove four specific lines in Notepad++ without delete similar lines

    2
    0 Votes
    2 Posts
    198 Views
    Alan KilbornA

    @ric12g

    Select those four lines in Notepad++ and press Ctrl+f.
    All of the line data will appear in the Find what box of the Find dialog, but it will appear to run together.

    Pressing Find Next at that point should find the block of four lines.

    From there you can proceed to a Replace operation, where you replace with nothing to effectively delete the lines.

    You probably want to make sure you get the line-ending on the 4th line in your original selection.

    If you’re trying to match similar but not exact matches (as your lower example hints at), then this is a slightly different problem. But rather than answer something you didn’t ask for, I’ll wait until that’s asked for. :-)

  • Font weight different than normal and bold?

    3
    0 Votes
    3 Posts
    296 Views
    T

    Alright, thanks.

  • Regular expression ( remove everything but leave certain code/word )

    7
    0 Votes
    7 Posts
    2k Views
    Handa FlockaH

    Thanks @PeterJones
    instruction very clear and it works
    appreciated

  • Notepad++ stuck in administrator mode [Solution]

    4
    0 Votes
    4 Posts
    533 Views
    PeterJonesP

    @mere-human said in Notepad++ stuck in administrator mode [Solution]:

    Should we add this somewhere into the user’s manual?

    Interesting thought. Selecting Administrator mode or not, and whether your shortcut or executable have that selected, is really more of a Windows OS question, not a Notepad++ - specific question.

    But if you had a good idea where in the manual to put it, I wouldn’t immediately reject an issue to add that (especially if it came with an accompanying PR).

  • how to Disable scrolling beyond the last line? (v7.9.2 and later)

    2
  • About column mode

    2
    0 Votes
    2 Posts
    239 Views
    lee bruceL

    You can try it yourself and see if there is a problem

  • 0 Votes
    2 Posts
    663 Views
    PeterJonesP

    @mplusplus

    You say “after”, but then your example shows deleting everything before and including. I will assume your data, not your description, are correct.

    FIND = (?-s)^(?:.*?/){2} finds two groups of anything (zero or more characters) up to a slash and the slash itself
    REPLACE = leave empty
    SEARCH MODE = regular expression

    3beb0b3a-c1a8-474a-9c52-20aead7eb6b0-image.png

  • 0 Votes
    3 Posts
    176 Views
    cll142C

    @PeterJones Thanks I got it. I had to nest it and I was able to have numbers stay blue instead of turning purple along with the delimiter.