• Find and replace by adding a value

    3
    0 Votes
    3 Posts
    295 Views
    David CRD

    ok! Tanks :)

  • append text to some lines only

    5
    1 Votes
    5 Posts
    340 Views
    namx3249N

    yes Alan, i’ve see that !

  • a regex question with new line

    6
    0 Votes
    6 Posts
    993 Views
    Daniel B. 0D

    another option! thanks for this too! :)

  • Page seems to be full of space characters just recently

    2
    0 Votes
    2 Posts
    199 Views
    PeterJonesP

    @Arthur-Hodgett ,

    next line by pressing the down arrow, it automatically returned to the last > on the next line, but now it just goes to the line below as if it was full of space characters

    My guess is that you (intentionally or accidentally) checkmarked the option Settings > Preferences > Editing > ☑ Enable Virtual Space, which allows you to place your cursor beyond the end of the line.

    (In a fresh installation / fresh portable, that option defaults to not being checkmarked, so you or someone else with access to your Notepad++ has turned it on, if I am correct about the culprit)

  • Help with Trimming text-Remove before and after words

    19
    0 Votes
    19 Posts
    2k Views
    guy038G

    Hi, @saltshaker2112, @terry-r, @coises, @mark-olson, @coises and All,

    Ah… OK. But, if we have to be less restritive on the text to keep, we must be more restrictive regarding the text to get rid of ! Thus :

    The part BEFORE the song’s title, which will be deleted, is :

    Any NON-word text followed with a number, followed by anything with a final dash AND, at least, ONE blank char

    Any number, up to three digits, possibly preceded with blank chars and followed with, at least, ONE blank char

    The part AFTER the song’s title, which will be deleted, is :

    At least ONE blank char, followed by any char among ([{<_-, followed by possible space chars, followed with a duration ( \d{1,2}(:)\d{2} ), followed with possible space chars, followed with any char among )]}>_- and finally followed with a combination of blank and new-line chars

    This part, which manages possible line-breaks, is then replaced by a single line-break ONLY

    So, starting with the INPUT text, below :

    01) - Bastille Day 5:19 02. - Lakeside Park [ 4:41 ] [03] - Bytor And The Snowdog 5:43 04 - Xanadu 12:06 05 - A Farewell To Kings ( 6:35 ) Something For Nothing 4:13 ((07 - Cygnus X-1 10:22 01 - Anthem 4:15 02- Closer To The Heart 999 - 3:35 - [03 ] - 2112 18:23 ( 03) - (2112) This Is A Test [2012 ] 18:23 03}} - [ 2112 ] This Is An Other Test 2012 <18:23 > 04 Working Man / Fly By Night / In The Mood / Drum Solo _15:16_ 05 - Cinderella Man 5:14

    Here is my new version of the first regex S/R, which get a clean list of the song’s titles :

    SEARCH (?x) ^ \h* (?: \W* \d+ \W* \h* - | \d{1,3} ) \h+ | \h+ [([{<_-]? \x20* \d{1,2} ( : ) \d{2} \x20* [)]}>_-]? ( \h* \R )+

    REPLACE ?1\r\n

    And you get this OUTPUT text :

    Bastille Day Lakeside Park Bytor And The Snowdog Xanadu A Farewell To Kings Something For Nothing Cygnus X-1 Anthem Closer To The Heart 999 2112 (2112) This Is A Test [2012 ] [ 2112 ] This Is An Other Test 2012 Working Man / Fly By Night / In The Mood / Drum Solo Cinderella Man

    Hope that it’s the expected one !!

    Of course, the second regex, regarding case changes, is the same as in my previous post !

    BR

    guy038

    P.S. Note that the simple lines, below :

    123 789 15:47 00 15:47

    With a song’s title containing less than four digits ONLY, with or without a leading rank, would wongly end up to :

    15:47 03:19

    I chose the limit of three digits, in order that lines with a leading rank up to three digits, immediately followed by the title, as below, are correctly handled ! Indeed :

    456 The most beautiful song of all the times (12:53)

    Would correctly result as :

    The most beautiful song of all the times
  • Disabling windows shell integration

    8
    0 Votes
    8 Posts
    899 Views
    John ParnellJ

    @PeterJones

    It’s making sense that the problem wasn’t fron the standalone package. I searched the Registry and there was some references to NPP in program files that no longer exists. It seems that probably what happened was when Windows failed to find that file reference so redirected to the existing standalone package with that executable once excecuted. I cleaned all Registry reference so Windows wouldn’t have a missing file reference to redirect and it hasn’t returned.

    It’s been awhile since I did a good Registry clean.

  • 0 Votes
    5 Posts
    414 Views
    Lycan ThropeL

    @Bonnie-Stevens ,
    The people here are not mind readers, regardless of your native language. If you refuse to read the documents that you have been given links to, to describe the problem you are having, then like the old computer programming adage, “Garbage in, Garbage out”, is all you will get.

    If you won’t put the work in to describe the issue, you can not be helped. Read links that Terry gave you.

  • I need help deleting text before a certain point.

    3
    0 Votes
    3 Posts
    307 Views
    Lycan ThropeL

    @Sam-Gabes
    Even though you’ve been given the answer to this one, be sure to check this link to learn how to do it yourself.

    https://community.notepad-plus-plus.org/topic/15765/faq-desk-where-to-find-regular-expressions-regex-documentation

  • Only showing null characters and strange symbols

    5
    0 Votes
    5 Posts
    441 Views
    TheMostExtremeRatParkourT

    @PeterJones ooohhh okay thanks

  • Add double quotes @ start and en of line + text in midle +more

    5
    0 Votes
    5 Posts
    3k Views
    Lufi SaL

    @Gilles-Girard said in Add double quotes @ start and en of line + text in midle +more:

    After many hours searching I now have a basic understanding (limited to autohotkey experience).
    Seeking help to put the pieces together.
    1- need to add double quotes to the start and end of each lines
    2- I need to make this a single line with additional text after the first line (or [Source.Name] =)
    The following list :
    Request 1.xls
    request 2.xls
    request 3.xls
    would become
    “Request 1.xls” or [Source.Name] = “request 2.xls” or [Source.Name] = “request 3.xls”

    Screenshot 2023-05-06 203733.png
    This script first initializes a variable fileList with the names of the files. It then loops through the list and adds double quotes to the start and end of each file name using the Chr() function to insert the ASCII code for a double quote (34).

    The script also creates a variable output to store the final output string. The first file name is added to the output variable without the “or [Source.Name] =” prefix, while the rest of the file names are appended to output with the prefix.

    Finally, the MsgBox command displays the final output string as a message box.

    You can customize the fileList variable to include your own list of files. Just replace the names in the square brackets with your own file names.

  • generic-regex-replacing-in-a-specific-zone-of-text

    9
    3 Votes
    9 Posts
    626 Views
    Mark OlsonM

    @Paul-Wormer
    Time to unpack the (?s-i:(?!ESR).)*? part of the regex, which is what your new version is currently missing.

    Essentially this is divided into four parts:

    the flags: ?s-i

    These say that:

    the . metacharacter should match everything (that’s the s flag) we want to be case-sensitive. That’s the -i part. consume a character unless the end of the search region is right ahead: (?!ESR).

    This looks ahead without consuming any characters to see if the ESR is in front of you, and then stops if it is. An example:
    Search string: cacb ab
    regex: (?!ab).
    At the start of the string, we look ahead for ab. The next character is c, so we consume c. (remember, this is SUCCESS because we want to NOT match the ESR).

    string: cacb ab want: _ab match: ! consumed: YES

    Now we’re after the first c, before the first a. We look ahead for ab, but see ac instead, so we’re clear to advance.

    string: cacb ab want: __ab match: *! consumed: YES

    You can see that there are no ab anywhere except at the end of the string, so everything will match.

    Let’s fast-forward to the end of the string:

    string: cacb ab want: ______ab match: ** consumed: NO

    We’re now positioned between the blankspace and the ending ab. The next two characters are ab, so this whitespace character will NOT be matched.

    Do the above thing any number of times: (?s-i:(?!ESR).)*?

    This just says to keep looking ahead and stopping if the ESR is ahead, then consuming a character, then looking ahead… until the ESR is reached or the entire string is consumed.

    Interesting note: Rexegg.com refers to this as “tempered greed” because you’re greedily trying to eat the whole string, but checking to see if you’re full before you take each bite.

    Putting it all together:

    So as @guy038 illustrated above, the (?-i:<text>|(?!\A)\G)(?s-i:(?!</text>).)*?\K-+ regular expression is going to start with (?-i:<text>|(?!\A)\G) by matching either <text> (the BSR) or the end of the last matched region (unless you wrapped around).
    Now the (?s-i:(?!</text>).)*? part comes into play. It behaves as I described above: the negative lookahead for </text> ensures that you cannot go past the ESR.

    The rest is the same, as you correctly identified:

    forget everything you matched so far (the \K) match any number of - characters (-+).

    For the record, I think that part of the problem with the readability of this regex has to do with the flags. The version of the regex without flags, (?:<text>|(?!\A)\G)(?:(?!</text>).)*?\K-+, is I think a bit less confusing.

  • .bak file

    4
    1 Votes
    4 Posts
    36k Views
    nghĩa lê nguyễn duyN

    @Dương-Minh-Hoàng Open Notepad++ and go to Settings=>Preferences=>Backup than select “None” from Backup on save. That’s it

  • Deleted a temporary new file, can I restore it?

    4
    0 Votes
    4 Posts
    238 Views
    I.zi.biaI

    @PeterJones said in Deleted a temporary new file, can I restore it?:

    If you had that option on, it would have kept a copy of your unsaved file in that directory

    It should be mentioned that this is true only for the “Main” instance (TheFirstOne in the npp source code) of npp.

  • Enable session snapshot and periodic backup?

    8
    0 Votes
    8 Posts
    2k Views
    I.zi.biaI

    @Michael-Vincent said in Enable session snapshot and periodic backup?:

    Again, without looking at the code, I believe “Remember current session for next launch” saves the current session on Notepad++ exit, whereas “Enable session snapshot and periodic backup” saves the current session on the time interface specified and at Notepad++ exit. In that respect, it’s more like a background auto-save in case of a “crash”?

    I have run some tests with npp v8.4.8, and my observations are different:

    “Enable session snapshot and periodic backup” only enables periodic snapshot. It has nothing common neither with sessions nor with config: I tried to kill notepad++.exe and I noticed no changes of config.xml and session.xml.

    Remember current session for next launch has two effects

    it allows that session.xml is (re)written on npp close it allows that session.xml is loaded on next startup of npp
    (of course, 1. and 2. happens only if all conditions are met.)

    (Unchecking Remember current session for next launch doesn’t delete existing session.xml, and so it may6 be activated later by config.xml edit)

  • Compatibility of Notepad++ 7.5.1 with Windows 11 pro

    2
    0 Votes
    2 Posts
    369 Views
    mkupperM

    @Özgür-Aydogdu said in Compatibility of Notepad++ 7.5.1 with Windows 11 pro:

    Is Notepad++ version 7.5.1 compatibel with Windows 11 pro?

    I use Win 11 normal (I assume home) and v7.5.1 portable 32-bit edition seems to run fine. I would assume it would also work on Win 11 Pro.

    It is safe and easy to download and try any of the portable versions. A portable copy of Notepad++ is just a set of files that don’t make any changes to the Windows registry or other parts of Windows.

    Note that if you want to run two or more versions of Notepad++ at the same time, side by side, then use the -multiInst command line option. If you don’t then the second instance of Notepad will see that the first is running and will jump to using that instead of the copy you wanted to start. For example, I had downloaded v7.5.1 to c:\bin\npp751 and so run it using c:\bin\npp751\notepad++ -multiInst Now I have my normal copy of Notepad++ running and a second Notepad++ that’s the v7.5.1 for testing.

  • problem with this regex: \b.{1,6}\b

    5
    0 Votes
    5 Posts
    292 Views
    Bahaa0013B

    @Mark-Olson
    Thank you very much, it worked very well…
    Also thanks to everyone who tried to help.

  • Find and Replace with variable within RegEx

    10
    0 Votes
    10 Posts
    1k Views
    guy038G

    Hi, @peterjones,

    Sorry, Peter, but as I well used to posting on our forum, I has not had a look, yet, to the FAQ about formatting :-((

    And, indeed, all is very well explained in this FAQ ;-)) So, my previous post is redundant and useless !

    BR

    guy038

  • How can I open timestamps?

    14
    0 Votes
    14 Posts
    1k Views
    Lycan ThropeL

    @Mark-Olson ,
    He still doesn’t get it. He doesn’t get that this is not a wordprocessor which MIGHT record those kind of changes within the meta data of the document. Let’s move on.

  • Ignoring empty lines counting

    24
    0 Votes
    24 Posts
    5k Views
    CoisesC

    @Alan-Kilborn said in Ignoring empty lines counting:

    @guy038 said in Ignoring empty lines counting:

    The regex ^$, indeed, does not count true empty lines !

    but :

    The regex ^\R does count empty lines !!

    If the regex is purely an assertion, e.g. ^$ or \b (to name but two), then its match won’t be counted by Count.

    True (since a pure assertion is always an empty match), but empty matches aren’t counted regardless of how the regular expression is specified. In a file that has empty lines, but no lines containing only capital Ws, ^W*$ counts zero matches. ^\R counts all empty lines (except the last line, if it’s empty) because it isn’t an empty match: it matches line ending characters. ^.*$ and ^.+$ both count all lines that are not empty.

  • Copy then paste elsewhere

    6
    0 Votes
    6 Posts
    574 Views
    Cal MurphyC

    @Alan-Kilborn

    Thanks for that i will have a look at it, when i have a bit of time available.